This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

How To Install Magento 2 on Localhost

Updated on  June 22, 2018

5 Min Read
Reading Time: 5 minutes

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.

Magento 2 Localhost

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

Xamp

  • 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.Lock

Composer Update

Get your Username and Password from Magento.com 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.

Installation

  • 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 http://127.0.0.1/magento2/
  • web/secure/base_url to https://127.0.0.1/magento2/

 

Share your opinion in the comment section. COMMENT NOW

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

About The Author

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 m.fayyaz@cloudways.com

Stay Connected:

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.