Magento is an eCommerce open source application that was bought by eBay, Inc. It’s a very popular eCommerce web application that runs on top of many opensource applications, like Apache, MySQL and others.
It helps independent sellers sell their stuff and engage with customers easily.

This brief tutorial is going to show you how to easily install it in Ubuntu 14.04 and maybe future versions. If you correctly follow the steps below, you’ll have a fully functional Magento eCommerce application ready to use on your Ubuntu machine.

This tutorial may also apply to future Ubuntu releases as they don’t change much. Magento also depends on the LAMP Stack.
The LAMP stack represents Linux, Apache, MySQL and PHP. These opensource application allows for feature-rich applications like WordPress and Magento to run and function.
When you’re ready, continue below to begin the process.

 

  • Installing the LAMP stack in Ubuntu

As we mentioned above, Magento won’t function without the LAMP stack. To get the stack installed in Ubuntu, follow the steps below.

Install Apache2 web server by running the commands below.

sudo apt-get install apache2

 

To start Apache web server, run the commands below

sudo service apache2 start

 

Next, open Apache default site configuration file in Ubuntu, then add the directory block below if the block isn’t in there already. If it’s there, then make sure it matches the block below highlighted in red:

sudo vi /etc/apache2/sites-available/000-default.conf

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

 

  • Install MySQL database server by running the commands below.

 

sudo apt-get install mysql-server mysql-client

 

While installing MySQL database, you’ll be prompted to create a root password for the database. Create it and remember it.

To start the database server, run the commands below
sudo service mysql start

 

After installing the database server, you should go and create a database and its user for Magento. To do that, run the commands below to logon to the database server.

mysql -u root -p

 

Then run the SQL statement below to create a database called magento
CREATE DATABASE magento;

 

Next create the database user called magentouser with password;
CREATE USER magentouser@localhost IDENTIFIED BY 'user_password';

 

Finally, grant all privileges to magentouser for magento database.

GRANT ALL ON magento.* TO magentouser@localhost;

 

 

  • Install PHP5 and other modules by running the commands below

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-gd php5-mysql php5-tidy php5-xmlrpc php5-curl php5-common php5-cli php5-ldap php5-xml

 

After installing PHP5, go and increase its memory limit from 128MB to 512MB. To do that, run the commands below to open the configuration file.

sudo vi /etc/php5/apache2/php.ini

 

Change the line below:

memory_limit = 128M

Change to:

memory_limit = 512M

Save the file.

 

  • Downloading Magento files.

 

The next step is to download Magento file and save it on the server. To do that, run the commands below to grab
cd /tmp/ && wget http://www.magentocommerce.com/downloads/assets/1.9.0.1/magento-1.9.0.1.zip

 

Next, extract the downloaded file.

unzip magento*.zip

 

The copy over the extracted files to the default Apache root directory, which is at /var/www/html/

sudo cp -rf magento/* /var/www/html/

 

Then change the ownership of the folder to Apache.

sudo chown -R www-data:www-data /var/www/html/

 

Change the permission of the files by running the commands below.

sudo chmod -R 755 /var/www/html/

 

Restart Apache and try connecting to the server.

sudo service apache2 restart

 

If everything was correctly followed, you should get he default Magento setup page as shown below.

 

Magento Setup Page

 

Continue with the setup

 

Magento setup

 

 

After setting it up as explained above, your site should up and running.

 

Enjoy!