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.
- sudo apt-get install php5.6-zip
- sudo apt-get install php5.6-intl
To locate your php.ini file in Ubuntu, open terminal and run following commands
- admin@admin:~$ cd /etc/php/5.6/apache2/
- admin@admin:/etc/php/5.6/apache2$ nano php.ini
- 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,
- 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:
Options Indexes FollowSymLinks MultiViews
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”