How to Install Magento 2 in Ubuntu?

Please fill this form, We'll reply within 24 Hrs.

Installing Magento 2

As per the Internet sources, Magento is the second most popular E-commerce platform. It requires development units to be connected to servers for storing the codes and checking the output. Ubuntu is based on Linux systems are based on the servers. Hence, it is very easy for Magento website development. Over and above, Ubuntu is freely available. It does not require the license like windows or Mac. So, here is the complete installation process for Magento 2 in Ubuntu.

System Requirements

  • A cloud server with at least 4 GB space as PHP and Magento requires 2 GB of space.
  • Magento runs on a LAMP stack (Linux, Apache, MySQL, and PHP). You can quickly install Apache, MySQL, and PHP using Tasksel and get it running fast.
  • Configure Apache version 2.2 or 2.4 and Virtual Hosts
    • Create a new virtual host file for your Magento site at the following path:
      • /etc/apache2/sites-available/
      • $ sudo nano /etc/apache2/sites-available/
    • Next, add the below mentioned lines to the file:
      • <VirtualHost *:80>
      • ServerName
      • ServerAlias
      • ServerAdmin webmaster@localhost
      • DocumentRoot /var/www/html/
      • ErrorLog /var/www/html/
      • CustomLog /var/www/html/ combined
      • <Directory /var/www/html/>
      • Options Indexes FollowSymLinks MultiViews
      • AllowOverride All
      • </Directory>
      • </VirtualHost>
    • Do not forget to save and close the file.
    • Moving further, enable the new virtual host and mod_rewrite module.
      • $ sudo a2ensite
      • $ sudo a2enmod rewrite
    • Then, disable the default virtual host configuration to avoid any conflict with the newly created one.
      • $ sudo a2dissite 000-default.conf
    • Restart the Apache service.
      • $ sudo service apache2 restart
    • Create a MySQL Database (version 5.6 or later) and user
      • A new database and user are recommended for fresh Magento installation. Login to your database using root user.
      • $ mysql -u root –p
      • First, create a new user and then the new database.
      • mysql> CREATE USER magento@localhost IDENTIFIED BY “your_password_here”;
      • mysql> create database magento;
      • Now, grant all privileges to the database, flush privileges, and exit.
      • mysql> GRANT ALL ON magento.* TO magento@localhost;
      • mysql> FLUSH PRIVILEGES;
      • mysql> exit
    • Configure PHP 7.0
      • $ apt-get update && apt-get upgrade
      • $ sudo apt-get install php7.0-common php7.0-gd php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-iconv mysql-client mysql-server

How to Install Magento 2?

Magento is open-source, hence you can easily download from its official website. Many versions will be available for download but opt for the latest release. Once the download is complete, extract the downloaded file and copy the contents to the following path using root permission:


Then set Apache ownership to the files and folders.

$ sudo chown -R www-data:www-data /var/www/html/

Now, to be presented with Magento installation wizard, open the following URL in your browser:


Install Magento 2

In the first step of the installation process, you will have to accept the “Terms and Agreement” and click “Continue”. Then it will perform the “Readiness Check” for all the system requirements mentioned above. Click next to enter Magento database settings. Enter the required valid details to move forward.

Next step is “Website Configuration” where you need to enter your store address and Magento admin address. It will be preferable to give a unique admin address other than /admin to keep your store secured.

Next comes “Customize your Store” by setting time zone, currency and language. Then “Create Admin Account” by filling in the required details. You are now ready to “Install”!

Magento Configuration

Launch the Magento admin to configure it. It gives lots of options for configuration, you can download the user guide from Magento to ease out the configuration process.

Hope you had a fun time installing Magento 2 on your Ubuntu system.

Need any help while installing? Talk to our Magento eCommerce consultantanytime!!

Mconnect Search Autocomplete Magento 2
Magento 2 ECommerce Development

Leave a Reply

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

Please fill this form, We'll reply within 24 Hrs.

Please fill this form, Mr.Yogesh will reply by email asap.

Please fill this form, Mr.Darshit will reply by email asap.

Please fill this form, Mr.Jayesh will reply by email asap.

Please fill this form, Mr.Jiten will reply by email asap.

Free eGuide

Ultimate Guide on Magento 2 Shipping Methods

Shipping Methods also play a very vital role in an eCommerce store, to make it a success.