Installing Magento Enterprise

by Rupert Jones.

Magento is an increasingly popular e-commerce platform due to its sheer flexibility, wide range of features and the facility to customise it relatively easily. In this post we will examine how to get Magento Enterprise set up and running. We assume a debian-based LAMP stack but these instructions could be adapted for any other platform as required.

Installing ionCube

Magento uses ionCube to encode some of the files for the Enterprise edition since version 1.8, so an ionCube 'loader' plugin is required for some elements of the Enterprise version to load. The plugin required depends on the server system you are using, and the version of PHP you have available; visit http://www.ioncube.com/loaders.php and find the appropriate package to download. Use "Copy link location" so that you may use the resulting address directly on the command line with wget rather than downloading the file to your own machine and uploading again.

The next step is to extract the plugin and make it available for PHP, for this example the correct package is ioncube_loaders_lin_x86.tar.gz:

root# cd /usr/local
root# wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
root# tar -zxvf ioncube_loaders_lin_x86.tar.gz

Enable the correct plugin for your version of PHP, so for example if you are using PHP version 5.2.x then use the following code, then restart apache.

root# echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.2.so' > /etc/php5/conf.d/ioncube.ini
root# /etc/init.d/apache2 restart

You can check that the IonCube loader plugin is working by running php -v; you should get output that looks something like this:

PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug4 2010 06:06:53)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with the ionCube PHP Loader v4.0.1, Copyright (c) 2002-2010, by ionCube Ltd.

Installing Magento

You need to obtain a Magento tarball and copy it to the server. The Magento Enterprise edition is not freely available, and so you must obtain a copy as per your Magento licence. The first step is to extract the Magento tarball and move the files into the directory where you will be running Magento. This varies from set-up to set-up, but we will use /var/www as an example.

root# tar -xvzf

This will untar Magento into a folder named after the version you are using, so for example if you are using 1.9.1.1 it will be extracted to 1.9.1.1/. These files need to be moved to where the webserver will pick them up

root# mv 1.9.1.1/* /var/www
root# mv 1.9.1.1/.* /var/www

The ownership and permissions need to be changed according to your webserver group set-up and Magento's requirements. In the following, exchange www-data for the group your Apache server runs under. You can find this by executing 'grep APACHE_RUN_GROUP /etc/apache2/envvars' from the command prompt and observing the output.

root# cd /var/www
root# chgrp www-data media/ && chmod 775 media/
root# chgrp www-data var/ -R && chmod 775 var/ -R
root# chgrp www-data app/etc && chmod 775 app/etc

All other files should be owned by a non-apache user, and permissions should be set according to the file purpose (755 for directories and executable files, and 644 for non-executable files).

Set up Database Schema

The next step is to set up a database schema for Magento to create its tables under, so we first create the database and create a specific user which Magento will use for accessing the database:

CREATE DATABASE <database_name>;
GRANT ALL PRIVILEGES ON <database_name>.* TO <username>@'<host>' IDENTIFIED BY '<password>';
FLUSH PRIVILEGES;

The database name, username and password you set up are up to you. However, for the most secure set-up you should restrict the host to the server you will be running Magento from; for a situation where the database and web server are on the same machine, you can simply give the host as 'localhost';

Apache Config

Next we need to point the webserver at the installation. Create a virtual host for this site in /etc/apache2/sites-available and add the following code, setting the domain name and web root appropriately:

<virtualHost *:80>
    ServerName <domain_name>
    DocumentRoot /var/www/
    <directory /var/www/>
        AllowOverride All
    </directory>
</virtualHost>

Now enable the site:

root# a2ensite <hostname>

And finally reload Apache:

root# /etc/init.d/apache reload

You should now be able to go to your domain address and be presented with the Magento installation screen. This will ask you to input the Magento database details you set up previously, as well as choose an administration username and password - and you are ready to go!

Although there are a few steps needed to set up this application, in particular the ionCube loader, I hope that this shows an easy way to make sure you have all you need to use the application.