Magento on Debian 5 (Lenny)

Updated by Linode Written by Stan Schwertly

Contribute on GitHub

Report an Issue | View File | Edit File

Deprecated
This guide has been deprecated and is no longer being maintained.

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 are new to Linux server administration, you may be interested in our introduction to Linux concepts guide, beginner’s guide and administration basics guide.

Installing Prerequisites

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:

/etc/php5/cli/php.ini
1
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.

Installing 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/example.com/public_html/
wget http://www.magentocommerce.com/downloads/docs/assets/1.4.1.0/magento-1.4.1.0.tar.gz
tar -zxvf magento-1.4.1.0.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-1.4.1.0.tar.gz

Web-based Installer

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!

SSL Certificates

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.

More Information

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.

Join our Community

Find answers, ask questions, and help others.

This guide is published under a CC BY-ND 4.0 license.