How to install Magento 2

We normally face some issues when installing Magento 2 for first time, so in this post we will learn how we can successfully install Magento 2 without any errors.

Before starting make sure you have installed wamp, or xamp for windows and LAMP if you are running Ubuntu on your machine, if not please install them first.

I’ll be installing Magento 2 on my local machine :Linux Ubuntu 16.04 with following specification.

  • PHP 5.6.3
  • MYSQL 5.7.12

I assume you meet all the prerequisites, so let’s starts with the installation process.

Step:1 Download latest Magento 2.x from

Extract and copy package in your project directory. in my case var/www/html/magetest2

Step:2 Open browser and hit : http://localhost/magetest2/

If you see 500 error, there may be permission issue, go to your project directory and run below command

admin@admin:/var/www/html$ cd magetest2
admin@admin:/var/www/html/magetest2$ sudo chmod -R uog+rw .

Now hit again: http://localhost/magetest2/ from your browser and follow Setup Wizard.





So here we are getting some php setting error, and this normally encounter in below PHP 7.0 versions.

Open your php.ini file and set “always_populate_raw_post_data = -1”.

If you see any other errors like missing intl or zip extension, then make sure they are installed and enabled in your php.ini file. You can installed them by running following commands in your terminal.

  1. sudo apt-get install php5.6-zip
  2. sudo apt-get install php5.6-intl

To locate your php.ini file in Ubuntu, open terminal and run following commands

  1. admin@admin:~$ cd /etc/php/5.6/apache2/
  2. admin@admin:/etc/php/5.6/apache2$ nano php.ini
  3. Edit your php.ini file, save and then restart apache.
    admin@admin:/etc/php/5.6/apache2$ sudo service apache2 restart

Refresh your browser:








Issues After Installation, js and css are not loading and admin 404:

This should be apache rewrite issue, open your terminal and type below command,

  1. sudo a2enmod rewrite

Edit : sudo gedit /etc/apache2/sites-enabled/000-default.conf

Inside that file, you will find the <VirtualHost *:80> block on line 1. Inside of that block, add the following block:

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

To put these changes into effect, restart Apache.

sudo service apache2 restart

Refresh you browser again:


Congratulation! We have successfully installed Magento 2, stay tune for our next post “How to create Custom theme in Magento 2”




Leave a Reply

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