Lesson 2.3: One installation per learner with exp:install
The safest lab gives every learner their own installation: nobody can break a neighbour's exercise, and every
learner can be an administrator. Exponential makes this cheap: exp:install installs a complete site on SQLite with
one command and no file to write first. This lesson teaches trainers to run it, check it and read its output.
At a glance
| Course | Train the trainer |
| Module | Module 2: Building the training lab |
| Duration | 45 minutes (10 presenting, 35 exercise) |
| Level | Intermediate |
| Audience | Trainers who prepare labs |
| Prerequisites | Lesson 2.2: a directory with the code |
Learning objectives
After this lesson, learners can:
- install Exponential with
php bin/php/console exp:install --applyand its most useful options; - check the configuration with
--printand the whole run with--dry-runbefore installing; - find the administrator login and the generated password, and remove the password file after the first login;
- explain why the command refuses to install over an existing installation without
--force.
Trainer's notes
How to present it
- Show the command in its simplest form (3 minutes):
php bin/php/console exp:install --applyinstalls thesevenx_multisitesite package on SQLite (var/storage/sqlite3/exponential.db) with the administratoradminand a generated password, shown once at the end. - Show
--print(2 minutes): it prints the configuration, passwords masked, and writes nothing. - Show
--dry-run(2 minutes): it checks the database and fetches the packages into a temporary repository, then stops before anything is written. Success ends with "Dry-run completed: database and remote packages verified. Stopped after SiteDetails, nothing written." - Explain the password (3 minutes): without
--passworda 24-character password is generated, shown in the summary and written tovar/log/initial-admin-password(mode 0600). After the first login, change it and delete the file. Well-known passwords such aspublishoradminare never installed.
Common questions
Can I give every learner the same password? You can pass --password= with at least 10 characters that is not
well known. For a classroom it is better to let each installation generate its own and have learners change it as
their first exercise.
What does --url do? It is the address every siteaccess's links are built from. For a lab served on the same
machine, --url=http://127.0.0.1:8087 matches the built-in server's default port (lesson 2.4).
What if the install fails? It prints which step stopped and why, and leaves the site in maintenance mode.
var/log/setup.log has the details; php bin/php/maintenance.php off ends maintenance after the cause is fixed.
Pitfalls
- Running as root. Run the command as the user who will serve the site.
- Re-running in the same directory. The command refuses: "This directory already holds an installation". That is a safety net; lesson 2.6 covers resets.
- A password in the shell history. For database passwords prefer the environment variable
EXP_INSTALL_DB_PASSWORDto an option (not needed for SQLite).
Hands-on exercise
In the editor-course directory from lesson 2.2 (or any fresh code directory):
php bin/php/console exp:install --print --url=http://127.0.0.1:8087 --title="Training site"and read the printed configuration: findSite_package,Type=sqlite3andEditorAccess.php bin/php/console exp:install --dry-run --url=http://127.0.0.1:8087 --title="Training site". Wait for the "Dry-run completed" line.- Install:
php bin/php/console exp:install --apply --url=http://127.0.0.1:8087 --title="Training site". - Read the summary: the site address, the administration login and the password. Copy the password to a safe place.
ls -l var/log/initial-admin-passwordandls -l var/storage/sqlite3/: the password file (owner-only) and the database file exist.- Run the install command once more without
--forceand read the refusal message. - Note how long the install took on this machine; this goes into your course timing.
Expected result
- The installation summary showed the site address,
adminas the login and a generated password. var/storage/sqlite3/exponential.dbexists;var/log/initial-admin-passwordexists with mode-rw-------.- The second run without
--forcestopped with "This directory already holds an installation" and changed nothing.
Quiz
- What does
exp:installinstall when no option is given? - What is the difference between
--printand--dry-run? - Where is a generated administrator password written, and what do you do with that file after the first login?
- Why does a second run in the same directory stop?
- Is
publishaccepted as the administrator password?
Answers
- The
sevenx_multisitesite package on SQLite, administratoradmin, a generated password. --printshows the configuration without any check of the database or the network;--dry-runconnects to the database and fetches the packages, then stops before writing (The console install, 7.6).- In
var/log/initial-admin-password; change the password, then delete the file. settings/override/site.ini.append.phpalready holds[DatabaseSettings]; without--forcethe command refuses to replace an installation.- No. Well-known passwords are replaced by a generated one, and the summary says why.
Further reading
- The console install: exp:install: every option.
- Install in one command: the feature page.
- The kickstarter: the same install from a reviewed
kickstart.ini. - After installing: what to do next.
Related pages
- Module 2: Building the training lab
- Train the trainer: course overview
- Trainers: start here
- 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.