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.
Make sure your package repositories and installed programs are up to date by issuing the following commands:
apt-get update apt-get upgrade --show-upgraded
Magento requires Apache to be installed to serve webpages, as well as PHP 5 and MySQL. If you're running an older version of PHP, you can use our PHP-CGI Apache guide to run PHP5 as a binary. Along with the base PHP5 install, you'll need several other extensions. The following command will attempt to install every required extension and then restart Apache:
apt-get install php5-mysql php5-curl php5-gd php5-mcrypt a2enmod rewrite /etc/init.d/apache2 restart
You will need to modify your PHP cli settings to ensure that the Magento installer has enough memory to run. You will want to set your PHP cli memory limit to at least 64M as shown below:
memory_limit = 64M
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 tips for optimizing memory. 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 into the directory you'd like to install Magento to. For this example we'll be installing Magento to our root directory. After switching, 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 at. 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 in the web-based installer, you will have a fully operating installation of Magento ready to be customized!
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 into 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 Amanda Folson on Monday, August 22nd, 2011 (r2433).