How to Install Magento 2

Hello There,

Have a nice day!


If you are visiting this post that means you are on the stepping stone in E-commerce world! And, you have made the right choice to select Magento 2 as the platform. I’ll guide you through the installation process of Magento 2.


Quick Intro:

In this article, we are going to install the Magento 2 step by step. We can say that Magento 2 is one of the leading platforms in building a perfect E-commerce store. Let’s Install Magento 2 Open Source edition. Magento 2 open source permits us to customize and develop our desired functionalities. 

Make sure you fulfill some basic Magento 2.x system requirements prior to installing Magento 2.

There are three ways to install Magento 2:

  1. Install via composer
  2. Install via Github

Let’s understand both method.

A composer is a tool for dependency management in PHP. To learn more about the composer, visit

Similar to above method, Magento core code is stored under /vendor directory and updating is possible through Magento admin.

Collect your authentication keys from here. Navigate to “My Access Keys”, enter a descriptive “Name” and generate a new set of keys.

Enter the following command in the terminal:

 composer create-project --repository-url= magento/project- 

Your public key is the username, and the private key is the password which is needed to be entered after which the Magento 2 is ready to install. Just go through the Setup Wizard and install it now.

That’s it for the installation of Magento 2 via composer without sample data.

Now I’ll show you how to install sample data. Navigate to Magento 2 root directory through the terminal, and run the following command:

When you run the above two commands, composer.json file will be updated and the sample data will be installed. If you are asked to re-run the Magento compile command, enter the following:

Sit back and wait for some time while the command is being executed.

Follow the below steps:

  1. Clone Magento 2 repo from or download a necessary release
  2. Create a new empty directory.
  3. Run the following command:
  4. Wait for the deployment to be finished.
  5. Enter the following command:
  6. Install Magento 2Example of the command that installs Magento 2. Check the base-url, db-name, db-password, admin-email, and admin-password to match your local setup.
  7. Open your browser and visit your local link
  8. Magento 2 is now installed!

To install Magento 2 via Github with sample data, follow the below steps:

  1. Go to the web root which is not Magento 2.
  2. Run the below command:
  3. Navigate to cloned Magento 2 directory.
  4. Run the below command:
    Symlinks to your Magento 2 installation are created.
  5. For Linux machine, you need to set ownership and permissions:
  6. Clear cache. Navigate to the Magento 2 var/ folder and run the below command:
  7. To install the sample data, run the below commands:

So that was all about Magento 2 installation  

Final Say:

Hence, by implementing the above steps you can install Magento in your system. If you have any question or face any issue drop us a comment and we will be get back to you with a solution soon. Or Hire a Magento Developer  for developing your desired and customized E-commerce store.


Share the article with your friends via social media platforms.


Thank You.