Unattended install with exp:install
This page is for bundlers who install the site from a script: an image's first boot, a panel installer, a CI job.
exp:install (also php bin/php/install.php --apply) "writes a kickstart.ini from its options and runs the kickstarter"
(The default administrator password). The full
reference is Chapter 7: The console install.
Contents
The shortest install
php bin/php/console exp:install --apply"That installs the multisite package on SQLite, in eng-US, with the siteaccesses site and admin reached by
URL, and prints a summary with the site and administration login addresses"
(Install in one command).
The options
From php bin/php/install.php --help (6.0.15):
| Group | Options |
|---|---|
| Database | --db (sqlite default, mysql/mariadb, pgsql, mongodb, oracle), --db-host, --db-port, --db-name, --db-user, --db-password, --db-socket, --db-action (remove default, ignore, skip) |
| Site | --package (default sevenx_multisite), --language (default eng-US), --languages, --title, --url, --access (url, host, port), --site-access, --admin-access, --host, --admin-host, --port, --admin-port, --editor-access, --editor-host, --editor-port |
Administrator (login admin) | --email (default [email protected]), --password, --random-password, --first-name, --last-name |
| Run | --force, --dry-run, --print, --help |
A few rules from the help text:
--hostor--admin-hostimply--access=host; "--access=host needs both --host and --admin-host", and they must differ.--password"is kept when it has at least 10 characters (site.ini MinPasswordLength) and is not a well-known one"; otherwise a generated one replaces it and the summary says so.--random-passwordgenerates 24 characters, "shown once at the end and written to var/log/initial-admin-password".- Always set
--urlfor a real site; the default ishttp://localhost. - Always set
--emailto an address of the recipient; the default is a placeholder.
Secrets
- Database password: "Give the database password with
--db-passwordor, better, with the environment variableEXP_INSTALL_DB_PASSWORD, which keeps it out of the process list and shell history." - Administrator password: let it be generated and hand it over from
var/log/initial-admin-password, or pass one from your secret store. "Never write it into a script or an image" (The default administrator password). --printshows the configuration "passwords masked";var/log/exp-install-<date>.inikeeps it masked too.
The database action
--db-action=remove is the default and "empties the database first". It is "what a fresh container wants, and
exactly what must never point at a database that holds data you need"
(4.6).
| Value | Use in a bundle |
|---|---|
remove | the first install into a new, empty database or a new SQLite file |
ignore | adding into an empty database; a second run adds a second copy of the data |
skip | rewriting the settings against an existing, complete database (--db-action=skip --force) |
Exit status and logs
| Status | Meaning |
|---|---|
0 | installed; or --dry-run passed; or --print; or --help |
1 | an option failed its check, the directory already holds an installation without --force, or the run failed |
On failure, maintenance mode stays on and var/log/setup.log says why
(7.7 Exit status). Keep var/log/setup.log and
var/log/kickstart.log from every failed bundle install.
Patterns for bundles
A dry run, then the install, failing on any error:
set -euo pipefail
export EXP_INSTALL_DB_PASSWORD="$(cat /run/secrets/db_password)"
php bin/php/console exp:install --dry-run --db=pgsql --db-host=db --db-name=site --db-user=site \
--url=https://www.example.com --email[email protected]
php bin/php/console exp:install --apply --db=pgsql --db-host=db --db-name=site --db-user=site \
--url=https://www.example.com --email[email protected]Separate hosts for the site and the administration:
php bin/php/console exp:install --apply --access=host --host=www.example.com --admin-host=admin.example.comRun it as the site's user, never as root: "Files created by root cannot be changed by the web server later"
(One-click installers). Install once, then never at
every start (First boot and install once).
Related pages
- exp:install for hosts
- The three installers
- Default credentials and first sign-in
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.