admin/ May 9, 2016/ Linux, Magento2

Ubuntu LTS 16.04 an opensource operating system which comes with long-term support(LTS).
To install Magento2 on Ubuntu 16.04 with Php7.0, Mysql-5.6, Apache 2.4.

Below are the few steps-:

Step 1-: Install required packages for Magento2 deployment.

sudo apt-get install apache2 php libapache2-mod-php mysql-server php-mysql php-dom \
php-simplexml php-curl php-intl php-xsl php-mbstring php-zip php-xml composer
sudo a2enmod rewrite

Open the apache2.conf file and AllowOverride all for Directory permission.

Like below-:

Make changes from

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


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

Restart the Apache2 server.

sudo systemctl restart apache2.service

Step 2-: Download the Magento2 code from github or git clone using below.

cd /var/ww/html/

git clone

cd magento2

composer install

if composer prompt for authentication like below-:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing magento/magento-composer-installer (0.1.6)
Downloading: 100%

- Installing braintree/braintree_php (2.39.0)
Downloading: 100%

- Installing justinrainbow/json-schema (1.6.1)
Downloading: 100%

- Installing symfony/console (v2.6.13)
Downloading: 100%

- Installing symfony/process (v2.8.4)
Downloading: 100%

- Installing symfony/finder (v2.8.4)
Downloading: 100%

- Installing seld/jsonlint (1.4.0)
Downloading: 100%

- Installing composer/composer (1.0.0-alpha10)
Downloading: 100%

- Installing magento/composer (1.0.2)
Authentication required (

Login here

Click on “My Account” on right top.

Use the Public key as UserName and Private Key as Password.

Step 3-:After install all dependencies by composer install command.
Change the required permission

sudo chmod -R 755 /var/www/html/magento2/
sudo chmod -R 777 /var/www/html/magento2/var/
sudo chmod -R 777 /var/www/html/magento2/pub/

Open the Web Browser ( Chrome, Firefox etc)

Follow the Magento2 installation Steps.

Step 4-: Schedule Magento2 Cronjobs
Finally schedule the backgound cronjobs for your magento2 installation. These cronjobs does some activities like, re-indexing, Newsletters, Update of currency rates, sending automatic emails and generating sitemaps etc. To schedule these jobs edit crontab file

crontab -e

and add below cronjobs at the end of file and save it.

*/1 * * * * www-data php /var/www/html/magento2/bin/magento cron:run
*/1 * * * * www-data php /var/www/html/magento2/update/cron.php
*/1 * * * * www-data php /var/www/html/magento2/bin/magento setup:cron:run

Step 5-: If Magento2 admin through error 404.
Open .htaccess file

 nano /var/www/html/magento2/.htaccess 

Uncomment the line

 #RewriteBase /magento/


 RewriteBase /magento2/ 

Gotechnies Magento 2 Blog

Rating: 4.9
Votes: 590
Reviews: 840

Share this Post