- Applies To: All Services
- Difficulty: Medium
- Time Needed: 10 minutes
- Tools Needed: SSH Client
- Reading Time: 9 minutes
This article will outline a couple different ways to install the latest version of Magento—with or without sample data—using the Command Line Interface (CLI).
Using SSH is the easiest and fastest way to install Magento, especially when you're trying to setup a store with 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.
For this install, there are four things you will need to know before you copy and paste the SSH commands:
- The database host name,
localhostworks for most
- The name of the database that Magento will use
- The username that has privileges to use the database
- The password for the database 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 DBHOST, DBNAME, DBUSER, and DBPASS with the appropriate information.
wget http://www.magentocommerce.com/downloads/assets/220.127.116.11/magento-18.104.22.168.tar.gz wget http://www.magentocommerce.com/downloads/assets/22.214.171.124/magento-sample-data-126.96.36.199.tar.gz tar xvf magento-188.8.131.52.tar.gz tar xvf magento-sample-data-184.108.40.206.tar.gz mv magento-sample-data-220.127.116.11/media/* magento/media/ mv magento-sample-data-18.104.22.168/magento_sample_data_for_22.214.171.124.sql magento/data.sql mv magento/* magento/.htaccess . mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < data.sql rm -rf *.sample magento/ magento-sample-data-126.96.36.199/ rm -rf magento-188.8.131.52.tar.gz magento-sample-data-184.108.40.206.tar.gz data.sql
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.
For this install there's nothing that needs to be replaced. You can just copy and paste the the SSH commands:
wget http://www.magentocommerce.com/downloads/assets/220.127.116.11/magento-18.104.22.168.tar.gz tar xvf magento-22.214.171.124.tar.gz mv magento/* magento/.htaccess . rm -rf *.sample magento/ magento-126.96.36.199.tar.gz
Wait, I thought we already just installed Magento? Well, not really. The above commands just prepared everything so we can actually install Magento using the command line or web-based installer.
Command Line Installer
Please follow the instructions in this article, and return back here once you've finished.
If you want to use the web-based installer, just point your browser to the address where Magento's files are located and follow the instructions. Return back here once you've finished.
Automated SSH Installer
Alternatively, there's a Bash script you can use that automates both the main steps of this article, the command line installer, and the commands below.
Once you've gone through the command line or web-based installer, run the following SSH commands:
./mage mage-setup . ./mage config-set preferred_state stable ./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force php -f shell/indexer.php reindexall
This will install the core Magento extensions so they'll show up in Magento Connect, which will allow you to install extensions and easily upgrade Magento in the future.