Posted in: Magento, SSH

Install Magento via SSH

There are many tutorials out there that show you how to install Magento using SSH, but in my experience, there is always something that is missing. Here’s a collection of what I’ve found to work. I am using the Magento Sample data on this installation as well. For those of you that aren’t needing the sample data, I will add this method to this post soon.

SSH into your site root where you want to install Magento. In this example we will be using /public_html/ as the site root.
Run the following commands from terminal: **CHANGE DBHOST DBUSER DBNAME to reflect your database information**
wget –content-disposition
tar xvf magento-
tar xvf magento-sample-data-
mv magento-sample-data-* magento/media/
mv magento-sample-data- magento/data.sql
mv magento/* magento/.htaccess .
mysql -h DBHOST -u DBUSER -p DBNAME < data.sql
**Enter database password at prompt
rm -rf *.sample magento/ magento-sample-data-
rm -rf magento- magento-sample-data- data.sql
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Install Magento.
You can now browse to your site and follow the web-based installation or you can use the Command Line Installer (CLI).
CLI Method:
Copy the following code into your preferred text editor and change the values to reflect your settings.

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"

Then copy your edited version and paste it into your terminal prompt.
Once that’s finished run the following in terminal:
chmod 750 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage install Mage_All_Latest –force
php -f shell/indexer.php reindexall
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

That’s it. You should now have the latest version of Magento installed on your server.

Have your say