Magento is a self hosted e-commerce solution used by many people to sell products online. It runs on a LAMP stack and offers the user a wide variety of options.
Before installing Magento, we assume that you have followed our getting started guide as well as our LAMP guide. If you're new to Linux server administration, you may be interested in our using Linux document series, including the beginner's guide and administration basics guide.
Before installing Magento, we must ensure that the universe repositories are enabled on your system. Your /etc/apt/sources.list should resemble the following (you may have to uncomment or add the universe lines:)
## main & restricted repositories deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted deb http://security.ubuntu.com/ubuntu karmic-security main restricted deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted ## universe repositories deb http://us.archive.ubuntu.com/ubuntu/ karmic universe deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe deb http://security.ubuntu.com/ubuntu karmic-security universe deb-src http://security.ubuntu.com/ubuntu karmic-security universe
If you had to enable new repositories, issue the following command to update your package lists:
apt-get update apt-get upgrade
Magento requires Apache to be installed to serve webpages, as well as PHP 5 and MySQL. Along with the base PHP5 install, you'll need several other extensions. The following commands will attempt to install every required extension and then restart Apache:
apt-get install php5-mysql php5-curl php5-gd php5-mcrypt php5-cli a2enmod rewrite /etc/init.d/apache2 restart
You'll also need to create a database for Magento, and a user with permission to access that database. The following commands provide an example of what steps would need to be taken to accomplish this:
mysql -u root -p CREATE DATABASE magento; CREATE USER mage; GRANT ALL ON magento.* TO 'mage' IDENTIFIED BY 'password'; exit
Please see our MySQL document for additional information regarding MySQL.
Additionally you will want to increase PHP's memory_limit setting, by editing the /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini file as follows:
File excerpt:/etc/php5/cli/php.ini and /etc/php5/apache2/php.ini
memory_limit = 64M
At this point your server has the prerequisites to install Magento.
Magento requires you to have a cookie on your system in order to download their packages. Alternatively, you can find the latest version of Magento on this wiki page for installing Magento via ssh. First we'll switch to the directory in which you'd like to install Magento. For this example we'll be installing Magento to our document root directory. After changing to the proper directory, we'll download the latest version of Magento, unpack it, grant the proper permissions and run pear. Run the following commands to install Magento:
cd /srv/www/bucknell.net/public_html/ wget http://www.magentocommerce.com/downloads/assets/188.8.131.52/magento-184.108.40.206.tar.gz tar -zxvf magento-220.127.116.11.tar.gz mv magento/* magento/.htaccess . chmod -R 777 var var/.htaccess app/etc media chown -R root:www-data app/etc/ var/ media/ ./pear mage-setup . ./pear install magento-core/Mage_All_Latest-stable rm -rf downloader/pearlib/cache/* downloader/pearlib/download/* rm -rf magento/ magento-18.104.22.168.tar.gz
From here you can point your browser to the URL you installed Magento to. All of these steps are straightforward. You'll be prompted to enter your database credentials that you created earlier, as well as an administrative username and password. After you finish the steps through the web-based installer, you will have a fully operating installation of Magento ready to be customized!
NOTE: If you receive an error message "example.com is not accessible # Unable to read response, or response is empty" during the Magento web-based installation procedure, be sure to check the "Skip URL validation" box before clicking continue.
You may want to install a commercial SSL certificate on your Magento website in order to encrypt the data passed between your customer's computer and your server. After following our obtaining a commercial SSL certificate document, you can set up your SSL certificate in the Administrative Area. After logging in to Magento, scroll over the "System" tab and select "Configuration". Click the "Web" tab on the left-hand side and drop down the "Secure" listing. From here you can alter your Base URL to include the https protocol.
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.
Last edited by Phil Paradis on Tuesday, May 17th, 2011 (r2013).