Command Line Installation Wizard
The typical installation scenario for SSH goes something like this:
- Grab the Magneto GZIP file
- Extract the files
- Set the appropriate permissions
- Run through the web-based installer
But did you know you can even use SSH to bypass the web-based installer and do it directly from the command line? Here's how to do it:
After you've gone through the basic installation steps, run the following command:
php-cli -f install.php -- \
--license_agreement_accepted "yes" \
--locale "en_US" \
--timezone "America/Los_Angeles" \
--default_currency "USD" \
--db_host "DB_HOST" \
--db_name "DB_NAME" \
--db_user "DB_USER" \
--db_pass "DB_PASS" \
--url "SITE_URL" \
--use_rewrites "yes" \
--use_secure "no" \
--secure_base_url "" \
--use_secure_admin "no" \
--admin_firstname "FIRST_NAME" \
--admin_lastname "LAST_NAME" \
--admin_email "EMAIL_ADDRESS" \
--admin_username "USERNAME" \
--admin_password "PASSWORD"
You'll want to replace the capitalized values with the correct information for your installation:
- DB_HOST - Databae hostname, in our case, localhost
- DB_NAME - The name of your database
- DB_USER - The username with access rights to the database
- DB_PASS - The password for the database user (alphanumeric only)
- SITE_URL - The path where Magento is installed, e.g. http://www.mydomain.com/store/
- FIRST_NAME - The store owner's first name
- LAST_NAME - The store owner's last name
- EMAIL_ADDRESS - The store owner's email address
- USERNAME - The administrator's username
- PASSWORD - The administrator's password (minimum 8 characters, alphanumeric only)
After you run that, it will tell you Magento was installed successfully. Since we didn't set the flag for the encryption key, one will automatically be generated and displayed on the screen.
There are a number of flags we can set that aren't listed in the previous example command, most of which are optional. You can also change some of the other required flags, like the locale, timezone, and default currency.
For a complete list of all the flags available, view the source code for the install.php file.
And just to give another example, here's a command with all of the flags set:
php-cli -f install.php -- \
--license_agreement_accepted "yes" \
--locale "en_US" \
--timezone "America/Los_Angeles" \
--default_currency "USD" \
--db_host "localhost" \
--db_name "magento" \
--db_user "dbuser" \
--db_pass "p4ssw0rd" \
--db_prefix "mag" \
--session_save "db" \
--admin_frontname "system" \
--url "http://www.widgets.com/store/" \
--use_rewrites "yes" \
--use_secure "yes" \
--secure_base_url "https://www.widgets.com/store/" \
--use_secure_admin "yes" \
--admin_firstname "John" \
--admin_lastname "Smith" \
--admin_email "john.smith@widgets.com" \
--admin_username "admin" \
--admin_password "a123b456" \
--encryption_key "BRuvuCrUd4aSWutr"
You should be able to recognize all of the flags above, they're the same things you set via the web-based installer.
It should be pointed out that you don't need to have this split up on individual lines. You can remove the line-breaks and the backslashes to put the whole command on one line. For the sake of readability, each flag is on its own line.
Related Articles
Installing Magento Via SSH
How to install Magento via SSH in either a subdirectory or root web directory, and with or without store sample data.