Magento is an e-commerce open source web application owned by eBay.inc. It is a widely used software for which a big community contributes and was built using components from the Zend Framework. It is built in PHP (5.2.13+), works with MySQL as a storage engine, and can be run using the Apache web server.It is used to design an e-commerce website. Many of the existeing e-commerce website uses magento such as videocon.com etc.
There are a couple of steps we need to take before the actual installation process to make sure Magento will run on our VPS.
First thing we should take care of is allow Magento to use enough PHP memory (it is recommended that PHP should be allowed 512 MB of RAM). To do this, edit the php.ini file:
nano /etc/php5/apache2/php.ini
And where you see this line:
memory_limit = 128M
Change it to:
memory_limit = 512M
Of course you may have that already or a different value – but you understand the point.
A next thing we'll need to take care of is a couple of PHP extensions (if you don't already have them installed). Run the following commands to take care of them:
sudo apt-get install libcurl3 php5-curl php5-gd php5-mcrypt
Since we are using Apache as a webserver and Magento can make use of URL rewriting, we'll need to also make sure that Apache will in fact let it do that. If you haven't already done the following steps, you'll need to do them now.
Edit the virtual host file that is responsible for the folder where Magento will be installed (in our case, the default Apache document root: /var/www):
sudo nano /etc/apache2/sites-available/default
Inside the block marked with this beginning:
Directory /var/www/
Make sure that instead of 'AllowOverride None' you have 'AllowOverride All'.
Next thing we need to do is enable mod_rewrite (again if you don't already have it enabled). To check if it's already enabled, use the following command:
apache2ctl -M
If you see "rewrite_module" in the list, you are fine. If not, use the following command to enable the module:
a2enmod rewrite
After all or some of these changes, restart the server to make sure the changes have taken effect so run the following command to do that:
sudo service apache2 restart
In this tutorial we install Magento straight into the root directory of our Apache webserver (/var/www). To do this, navigate to that folder:
cd /var/www
And run the following command to download the software:
wget http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.8.1.0.tar.gz
To untar the file we just downloaded:
tar -zxvf magento-1.8.1.0.tar.gz
To remove the .tar file since you won't be needing it after this step:
rm magento-1.8.1.0.tar.gz
Since Magento will run from within the webserver document root, let's move all the files and folders that belong to the software into the /var/www folder:
mv magento/* magento/.htaccess .
Next, let's make sure some application folders can be written by the web server. While being in the /var/www folder, run the following commands:
chmod -R o+w media var
chmod o+w app/etc
This will give permissions to the Apache user to write in these folders. Now it's time to go to the browser and run the web installer. Navigate therefore to your VPS IP address and you should see a welcome page:
Welcome to Magento's Installation Wizard!
Read and agree to the terms and conditions and press Continue. On the next screen you have to select your locale information (language, default currency, etc). After doing that, move on to the next screen. It follows to enter the database information and credentials (remember the db we just created?). You can leave the Host field as it is and unless you really want table prefixing, leave that field empty as well.
Right below the db information, you can specify some other global settings. Enter the base url you'll want to have (this is probably the domain name that will be tied to your VPS IP) and the admin path. You can check the next box as well since we enabled our webserver to allow .htaccess rewrites:
Use Web Server (Apache) Rewrites
Magento is now installed.