Back to Top

Installation of Magento2 on Ubuntu

Updated 29 October 2015

Pre Installation Requirements-:

1. LAMP should be installed on the system with mysql-server-5.6 (Updated version).

2. MOD_REWRITE should be enabled on the system.

3. All Files of magento2 should have 600 and directories have 700 permissions.

4. Apache user and the owner of Magento2 directory should be the same. (Magento2 should run with the apache user).

Searching for an experienced
Magento Company ?
Find out More

5. If you have apache root directory setup on some different location other than “/var/www” then you have to replace the /var/www with your apache root directory.

Installation Steps -:

1. LAMP installation.

2. Enable mod_rewrite by executing command in terminal

sudo a2enmod rewrite.

3. Now open the apache2.conf file

sudo nano /etc/apache2/apache2.conf

and search for something like given below-:

<Directory /var/www>

Options Indexes FollowSymLinks

AllowOverride None

Require all granted


now replace the above as follows (do not use {})-:

<Directory /var/www >

Options Indexes FollowSymLinks

AllowOverride {All}

Require all granted


4. Restart the apache service by

sudo /etc/init.d/apache2 restart

5. Now install composer by executing given below commands in your terminal.

apt-get update

apt-get install git wget

wget -O /usr/local/bin/composer

chmod +x /usr/local/bin/composer

6. Download the magento2 from git by executing given below commands-:

cd /var/www

git clone

cd /var/www/magento2

composer install

Now if your apache user and owner of magento2 file is same then you can skip point 7 and 8

7. Change the ownership of magento2 by executing given below command for example-:

you have username “magtest” then your command should be

chown magtest -R /var/www/magento2

8. Now change the user of apache server for example you have the username “magtest”.

open the envvars file by executing-:

sudo nano /etc/apache2/envvars

now find “export APACHE_RUN_USER=www-data” and replace the www-data with “magtest” user

then it should look like

export APACHE_RUN_USER=magtest

save the file by ctrl+x

9. Restart the apache server by executing

 sudo /etc/init.d/apache2 restart

10. Now install the magento2 by accessing the URL-: http://localhost/magento2


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home