• Applies To: All Services
  • Difficulty: Medium
  • Time Needed: 5 minutes
  • Tools Needed: SSH Client
  • Reading Time: 9 minutes

*Save 50% on your first payment* by signing up today!

We want to earn your business. Use the promotional code CRUCIAL50 during checkout, and take an additional 50% off your first hosting payment plus have a 30 day FULL money back guarantee!.

*This offer is only available for new customers
*This special discount may end at any time - Act Now!

The typical installation scenario for SSH goes something like this:

  1. Download Magento
  2. Extract the files
  3. Set the appropriate permissions
  4. 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/Phoenix" \
--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:

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/Phoenix" \
--default_currency "USD" \
--db_host "localhost" \
--db_name "exammcom_magento" \
--db_user "exammcom_magento" \
--db_pass "p4ssw0rd" \
--db_prefix "mag" \
--session_save "db" \
--admin_frontname "system" \
--url "http://www.example.com/store/" \
--use_rewrites "yes" \
--use_secure "yes" \
--secure_base_url "https://www.example.com/store/" \
--use_secure_admin "yes" \
--admin_firstname "John" \
--admin_lastname "Smith" \
--admin_email "john.smith@example.com" \
--admin_username "admin" \
--admin_password "A123b456C" \
--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.