Magento 2 has just launched this month so today I will show you how to install Magento 2 on Ubuntu.

Before you start:

  • You have to LAMP on your computer first with Mysql-server latest version
  • After finishing the installation of Lamp, you have to turn on Mod-rewrite mode
  • To install Magento 2 you have to use more than 650 directories and 710 permission
  • You need to set up  a same user with the owner of Magento 2. Why do you have to do this? It’s because of the running together of Magento 2 with apache user)
  • You have to change the /var/www with the directory of apache root if there is a different in the location of apache root directory setup.

Let’s start to install Magento 2 on Ubuntu 

1. To install Magento 2, you have to install Lamp on your computer.

If you already have this software, skip this step.

2. Using this command to turn on the Mod_Rewrite mode:

sudo a2enmod rewrite.

3. You have to find the apache2.conf file

sudo nano /etc/apache2/apache2.conf

and then open it to see the following code:

<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

Delete the above code and then paste these code:

<Directory /var/www >
Options Indexes FollowSymLinks
AllowOverride {All}
Require all granted
</Directory>

4. Done, now you have to restart the server to apply the changes by using this command:

sudo /etc/init.d/apache2 restart

5. With Magento 2, we have to install composer to manage your store.

The installation of composer follows this command:
apt-get update
apt-get install git wget
wget -O /usr/local/bin/composer http://getcomposer.org/composer.phar
chmod +x /usr/local/bin/composer
As I said above if you use the same ID for apacher user and owner of Magento 2 you don’t need to do step 7 and 8.

7.  You don’t create a same ID for apacher user and owner of Magento 2, now you have to change the owner of Magento 2 by doing this command:

chown mageadmin -R /var/www/magento2
The above command is used for username: “mageadmin”

8.  After changing the owner of Magento 2. Now you have to change the apacher’s user:

Use this command to open the envvars file:
sudo nano /etc/apache2/envvars
Search for export APACHE_RUN_USER=www-data and replace it with magadmin user. You will have to new command:
export APACHE_RUN_USER=mageadmin
Use ctrl + X to save the envvars file.

9. Now to apply the changes you have to restart the apache server by this command:

sudo /etc/init.d/apache2 restart

10. Everything is ok, you type this address to your address bar of your browser:

http://localhost/magento2

Now you can set up your store with Magento 2 on ubuntu as same as windows .

Magento 2.0

You can see how to configure Magento 2 at this guide and this.

Author

Kate N. is now working as a Retail Solution Specialist at Magestore. She has 3+ years of experience in brand management, marketing, and customer's insights. Kate loves to travel to experience new cultures and discover what is happening with retail all around the world.

Write A Comment