general:magento_installation_via_ssh

Last modified by Crucial on Sat, August 2, 2008 04:59
Source|Old Revisions  

This is an old revision of the document!


This article will outline a couple different ways to install the latest version of Magento via shell, and will take advantage of the PEAR downloader so you can use Magento Connect to upgrade Magento or add extensions.

We will cover how to install Magento with and without sample data, and how to install Magento in a subdirectory or the web root directory.

The web root directory simply means what immediately comes up when you access your domain, compared to a sub-directory install, which is how Magento is setup by default.

Using SSH is the easiest and fastest way to install Magento, especially when you’re trying to setup a store the sample data. Normally, that requires you to download about 45 MB worth of data and then re-upload it to your website. With SSH, we can take advantage of the connection of the server to grab the necessary files.

With Sample Data

This is typically how Magento is installed, especially if you want to familiarize yourself with Magento and see how they setup categories and products.

Subdirectory

For this install, there are four things you will need to know before you copy and paste the SSH commands and run the install.

  1. Subdirectory name where Magento will be installed
  2. The name of the database that Magento will use
  3. The username that has privileges to use the database
  4. The password for that user

Once you have that information, you’ll want to copy and paste the commands for the type of install you want and replace what’s there with the information from above. It’s best to copy this into notepad or something similar.

So that means you’ll be replacing the word SUBDIRECTORY below (two times) to the name of the subdirectory where you want Magento installed, and DBNAME, DBUSER, and DBPASS.

  1. mkdir SUBDIRECTORY
  2. cd SUBDIRECTORY
  3. wget http://www.magentocommerce.com/downloads/assets/1.1.2/magento-1.1.2.tar.gz
  4. wget http://www.magentocommerce.com/downloads/assets/1.0.19870/magento-sample-data-1.0.19870.tar.gz
  5. tar -zxvf magento-1.1.2.tar.gz
  6. tar -zxvf magento-sample-data-1.0.19870.tar.gz
  7. mv magento-sample-data-1.0.19870/media/* magento/media/
  8. mv magento-sample-data-1.0.19870/magento_sample_data_for_1.0.19870.sql magento/data.sql
  9. mv magento/* magento/.htaccess .
  10. chmod o+w var var/.htaccess app/etc
  11. chmod -R o+w media
  12. mysql -u DBUSER -pDBPASS DBNAME < data.sql
  13. ./pear mage-setup .
  14. ./pear install -f magento-core/Mage_All_Latest-stable
  15. rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
  16. rm -rf magento/ magento-sample-data-1.0.19870/
  17. rm -rf magento-1.1.2.tar.gz magento-sample-data-1.0.19870.tar.gz data.sql
  18. find . -type d -exec chmod 777 {} \;

Root Web Directory

This is almost the same as above, except you don’t need to know the directory name. You will only have to replace DBNAME, DBUSER, and DBPASS.

  1. wget http://www.magentocommerce.com/downloads/assets/1.1.2/magento-1.1.2.tar.gz
  2. wget http://www.magentocommerce.com/downloads/assets/1.0.19870/magento-sample-data-1.0.19870.tar.gz
  3. tar -zxvf magento-1.1.2.tar.gz
  4. tar -zxvf magento-sample-data-1.0.19870.tar.gz
  5. mv magento-sample-data-1.0.19870/media/* magento/media/
  6. mv magento-sample-data-1.0.19870/magento_sample_data_for_1.0.19870.sql magento/data.sql
  7. mv magento/* magento/.htaccess .
  8. chmod o+w var var/.htaccess app/etc
  9. chmod -R o+w media
  10. mysql -u DBUSER -pDBPASS DBNAME < data.sql
  11. ./pear mage-setup .
  12. ./pear install -f magento-core/Mage_All_Latest-stable
  13. rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
  14. rm -rf magento/ magento-sample-data-1.0.19870/
  15. rm -rf magento-1.1.2.tar.gz magento-sample-data-1.0.19870.tar.gz data.sql
  16. find . -type d -exec chmod 777 {} \;

Without Sample Data

You’ll choose this method to install Magento when you’re ready to start developing your store and adding your own products.

Subdirectory

For this install you only need to replace SUBDIRECTORY below (two times) with the name of the subdirectory that you want Magento installed in.

  1. mkdir SUBDIRECTORY
  2. cd SUBDIRECTORY
  3. wget http://www.magentocommerce.com/downloads/assets/1.1.2/magento-1.1.2.tar.gz
  4. tar -zxvf magento-1.1.2.tar.gz
  5. mv magento/* magento/.htaccess .
  6. chmod o+w var var/.htaccess app/etc
  7. chmod -R o+w media
  8. ./pear mage-setup .
  9. ./pear install -f magento-core/Mage_All_Latest-stable
  10. rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
  11. rm -rf magento/ magento-1.1.2.tar.gz
  12. find . -type d -exec chmod 777 {} \;

Root Web Directory

This is the easiest to install, because there’s nothing to change.

  1. wget http://www.magentocommerce.com/downloads/assets/1.1.2/magento-1.1.2.tar.gz
  2. tar -zxvf magento-1.1.2.tar.gz
  3. mv magento/* magento/.htaccess .
  4. chmod o+w var var/.htaccess app/etc
  5. chmod -R o+w media
  6. ./pear mage-setup .
  7. ./pear install -f magento-core/Mage_All_Latest-stable
  8. rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
  9. rm -rf magento/ magento-1.1.2.tar.gz
  10. find . -type d -exec chmod 777 {} \;

Conclusion

After you have installed Magento via SSH, you can proceed through the web-based installer. You’ll use the same database details in that as well. There is a way to run through the web-based installer in SSH as well, but we’ll save that for another article.

Even though all of the above scenarios are downloading the 1.0 version, Magento will upgrade itself with the PEAR downloader. This will also setup your install so you can use Magento Connect to upgrade Magento and install extensions.

URL Not Accessible

As mentioned in this thread, if you receive an error message that says URL not accessible, you’ll want to remove the following lines:

  1. ./pear mage-setup .
  2. ./pear install -f magento-core/Mage_All_Latest-stable

After you’ve gone through the web-based installer, then you can run those two commands to upgrade Magento to the lastest version, or use Magento Connect.

Please Note:




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs