Magento needs a working LAMP stack. Let start off the installation by setting up a LAMP stack first. It can be done using the following command.
apt-get dist-upgrade apt-get install lamp-server^
We would also need the extension packages php5-gd, php5-curl, php5-mcrypt as dependencies. Let’s install these 3 packages as well and enable appropriate extensions as well.
apt-get install php5-gd php5-curl php5-mcrypt php5enmod mcrypt
Let us now configure the database for Magento. We would need to create a database and grant prvileges for a user.
mysql -uroot -p mysql> create database magento; mysql> GRANT ALL ON magento.* TO 'magentouser'@'localhost' IDENTIFIED BY 'magentopassword'; mysql> quit
Magento web application is available in tar.gz or zip format. We will be downloading the Magento application in tar.gz. For that, we need to login to Magento web page link. Once downloaded, copy the file to the server and extract it.
tar -xzvf magento-22.214.171.124-2016-01-20-03-02-19.tar.gz
Let us now transfer the package files to the apache root directory i.e. /var/www/html.
rsync -avz magento/ /var/www/html
We need to have appropriate ownership for the files in /var/www/html. Let us change that now.
cd /var/www/html cp errors/local.xml.sample errors/local.xml chown -R www-data:www-data *
We need to make the file index.php as the first file for apache to load. We can edit the file ‘/etc/apache2/mods-available/dir.conf’ and change the following line to look like this.
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
Once this is done let us restart Apache service
service apache2 restart
Now we can load Magento by using the following URL. We need to replace the ‘ip-address’ with appropriate IP of our server.
The admin page can be accessed using the following address.