How To Install Magento 2 on Localhost

by Fayyaz Khattak  December 14, 2015

After the official release of Magento 2, a number of people went on to install it on their localhost or their hosting server providers. For developers, Magento 2 installation on localhost is a pretty painful experience.

 Install Magento 2 on Localhost Using Xampp

Magento 2 comes with many requirements. Magento 2 requires a lot of server configurations and tweaking along with composer setup which are not set by default. Let me clear this for a lot of those who are wondering why composer is really a need in Magento 2. Composer enables us to manage the Magento system, extensions, its dependencies, and also allows us to declare libraries for the project. In this article, I will explain how you can install Magento 2 on your localhost by using XAMPP.

Before you start your installation, you need to have these things on hand:

1: XAMPP Server installed in your computer.

2: Magento 2 Downloaded (You can download Magento 2 from this link)

Magento 2 has some installation requirements like:

  • Apache Version 2.2 or 2.4
  • PHP Version 5.5.x or 5.6.x
  • MySQL Version 5.6x

Cloudways Magento Hosting For Developers

Now we can go towards the installation processes. I will be covering the whole installation step-by-step to make it easy for you:

  • Open your XAMPP server and start Apache and MySQL applications


  • Extract Magento 2 files in your xampp/htdocs folder

Install Composer

Download and run Composer-Setup.exe. It will install the latest composer version and set up your path so that you can just call “composer” from any directory in your command line.

Composer Setup

Click next and select “Install Shell Menus”

Composer Shell Setup

In the next step, you would need php.exe path to proceed with the composer setup and provide the path of php.exe

Select Path

Select Path Magento

Now click on install to see the final step

Composer Ready To Install

Composer Setup Completed

After installing the composer, you must enable the extension (php_intl.dll) in your php.ini file. To enable the extension, go to your php.ini and uncommenting the line “extension=php_intl.dll” and just remove semicolon “;” from the starting of the line and restart your XAMPP control panel.

After this, go to the Magento 2 folder inside your htdocs folder. Hold the Shift key and right click, and Select “Open command window here”. This will open command prompt on the location.

In command prompt, execute the command “composer install”. This will install Magento 2 on your localhost.

Note: If you see the error show in the image below, then go to your Magento 2 directory and right-click on composer.lock file and select “composer update”


Composer Update

Get your Username and Password from and click My Account. Now click on Secure Keys under Developers tab on the left hand.

Magento Connect

Your Public key is your Username and your Private key is your password.

Composer Public Key

Now create an empty database with correct permissions in your phpmyadmin.


  • Enter your Magento 2 URL in browser e.g. localhost/m2

Magento 2 URL

Click on Agree and Set Up Magento.

Magento 2 Installer

Magento 2 will check your environment for readiness. Click on Start Readiness Check.

Magento 2 Installer Started

Now enter your database information that you previously created.

Magento 2 Installer Database

Click next, and you will be asked for web configurations like store URL, admin URL, Apache rewrites and https options.

Magento 2 Installer Finishing

Click Next, and select your Timezone, Currency and language in “Customize Your Store” section.

Magento 2 Timezone

Click next, and insert your back-end Admin username, email and password to setup Admin credentials.

Magento 2 Admin

Now click next and Magento 2 is ready to be installed on your localhost. Click on Install Now and as a word of caution, don’t close your browser until setup is done.

Magento 2 Ready To Install

Magento 2 Installer Step 6


Magento 2 Installed Successfully

Congratulations! You have now successfully installed Magento 2 on your localhost. You can now start making your preferred customizations and launch your own ecommerce store based on the most famous Magento software.

Worried about hosting? You don’t need to worry as long as Cloudways Managed Magento Hosting is here for increasing your everyday sales and taking away your server side management hassles. You just focus on building an awesome Magento 2 based ecommerce website and we will take care of the rest. And if you have any issues while installing Magento 2, you can go ahead and ask me via the comments section.

Note: If you face an error in your Magento 2 Admin url, then Go to your Magento 2 database and search “core_config_data” table and change the following 2 rows

  • web/unsecure/base_url to
  • web/secure/base_url to


Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways – A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at

Stay Connected:

You Might Also Like...

  • Mark Henry

    It is very useful. Thanks for sharing such a great post. Keep it up.

  • I follow this process and successfully install magento but i do it manually. I don’t use composer or bower.

    • Dev Das

      How did you do it manually? I was trying and it didn’t work :o(

      • Why it did nt work? Can you tell me any error you get?

  • Alexis Rengifo

    First time and it went well, thanks.

  • Thiago Oliveira

    After installing this problem occurs :

    This page has a redirect loop

    Already edited rows in the table ” core_config_data ” but the problem continues.

    Some other solution ?

  • The easiest way to install Magento 2 is to install it from archive file. You can download it from magentocommerce download page. Access the website folder like localhost/magento2 and follow the setup wizard.