How to Install Magento 2

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.

Make sure you fulfill some basic Magento 2.x system requirements prior to installing Magento 2. You can also install Magento 2 via command line.

There are three ways to install Magento 2:

  1. Install from the archive file
  2. Install via composer
  3. Install via Github

Let’s understand each method.

    1. Visit the Magento Download Page. Download the latest Magento 2 package from any of the archive types (zip, tar.gz, tar.bz2), with or without sample data.
    2. Now upload the zip file to the server and extract it to Magento root directory.
    3. For shared hosting users, you can unzip or extract the package.
    4. For the local server, follow the commands below:
    5.  Run below command to add write permission for var, app/etc, pub folders.
    6. Now run Magento setup wizard and finish installation process.
  1. 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:

    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.

  2. 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

You can always refer the for more details or ask your doubts in the Comments section below. I’d be happy to help

Best wishes for your online store success with the help of latest Magento 2.4.4 features and security!

Feel free to share the tutorial with Magento Community via social media

Thank you.

(based on 10 Reviews)
How to Install Magento 2Author Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.


Leave a Reply

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