Magento Tutorials

How to Install Magento 2 on Localhost

how-to-install-magento-2-localhost

It has been quite a long time since Magento introduced their 2.0 version. With more friendly user interface and improved performance, it is likely that many existing Magento 1 users will move to Magento 2 sooner or later. Flowing with the trend, SimiCart also released Magento 2 mobile app in December 2016.

Today, I’m gonna show you how to install Magento 2 locally on your computer. This guide is targeted on current Magento 1 users and also users who are completely new to Magento. Now, let’s get started!

Part 1: Install and configure XAMPP

Step 1: Download XAMPP

You can download the latest XAMPP version on Apache Friends website: https://www.apachefriends.org/index.html

Step 2: Install XAMPP

After downloading XAMPP, double-click on the file to install it on your computer.

Click Next.

install magento 2

Leave the default selection as in the image. Click Next.

install magento 2 on localhost

Choose your installation folder. The default location is C:\xampp. After that, click Next.

localhost magento

Click Next.

magento 2 on localhost

Click Next.

install magento

Setup will now install xampp on your computer. Please wait for a while.

install magento on locahost

After setup is finished, you will see the option “Do you want to start the Control Panel now?”. Keep it selected. Click Finish to exit setup and enter XAMPP Control Panel.

magento 2

Step 3: Configure XAMPP

In XAMPP Control Panel, click Config button on Apache row, and click “PHP (php.ini)”.
In the php.ini file, find these rows and remove “;” before each row:

extension=php_curl.dll
extension=php_pdo_sqlite.dll
extension=php_pdo_mysql.dll
extension=php_soap.dll

configure magento 2

After you’ve done, save and close the file. Then, click the Start button on 2 rows Apache and MySQL to start them. Don’t quit XAMPP after this step, just let it run.

Step 4: Configure host file

Open file “C:\Windows\System32\drivers\etc\hosts”. Add the following line to the last row of the file:

127.0.0.1 www.localhost.com

 

 

Part 2: Download and install Magento 2

Step 1: Download Magento 2 with sample data

You can download the latest Magento 2 release along with sample data from Magento website: https://magento.com/tech-resources/download.

download magento 2

The archive file is available in 3 formats: .zip, .tar.gz, and .tar.bz2. They are all the same, you can choose any format you like. Then, click Download. If you are not logged in yet, there will be a popup requiring you to sign in to your account. If you don’t have an account, click on “Create an account now”.

magento 2 download

After the download is complete, create a folder inside “xampp\htdocs” and extract the downloaded archive file into that folder. This will take some time.

Step 3: Create a new empty database for Magento 2

Browse the URL http://localhost/phpmyadmin/ to access phpMyAdmin page. Create a database name (“Magento2”, for example) and click Create.

configure magento 2 on localhost

Step 4: Install Magento 2

With XAMPP still open, in your browser, enter the URL http://localhost/your_database_name to start installing Magento 2. In previous step, I named my database as “Magento2” so I enter the URL “http://localhost/Magento2”.

Click “Agree and Setup Magento“.

setup magento 2

Click “Start Readiness Check“.

setup magento 2 on localhost

It will then check your server environment if it is ready to install Magento 2. If there are errors remaining (the red X), you will have to solve them first before you can proceed to the next step.

*Tips to solve PHP problems:

  • PHP Settings Check: On XAMPP Control Panel, click “Config” on Apache row, then click “PHP (php.ini)” to open php.ini file. Find the line “always_populate_raw_post_data” and delete “;” at the start of the line.
  • PHP Extensions Check: for any missing extension, find the string “php_extension-name.dll” and delete “;” at the start of that line. For example, according to the Check, I am missing XSL extension, so I look for “php_xsl.dll” in php.ini file and then delete “;” at the start of the line.

After you’ve solved all issues, save and close php.ini file and restart XAMPP. Then, click “Try Again” to refresh Magento 2 Installation page.

setup magento

Click Next.

install magento 2 locally

Add a database: Database Name is the name of the database you created in Step 3. You can leave other fields as default. Click Next.

install magento locally

Enter the URL for your store address and Magento admin address. You can leave these by default or edit as you wish. Then, click Next.

magento on localhost

Edit your store’s time zone, default currency and default language. Click Next.

setup magento 2 locally

Create an admin account. This will be the account that you use to log into your Magento backend. After you’ve filled in all the fields, click Next.

magento 2

Finally, click Install Now.

localhost magento 2

The installation will take a while.

magento download

That’s it! You have finished installing Magento 2 on your localhost. Now you can access your Magento 2 frontend/backend and start exploring Magento 2 features. I hope you find this post helpful 🙂

 

Related posts:
How to Install Magento 2 Using Composer
How to Install Magento 2 on Ubuntu 16 Using Nginx
How to Install Magento 2 on WAMP Server Localhost

How to Install Magento 2 on Localhost
5 (100%) 4 vote[s]
11 Comments

Dom

A knowledge craver who always strive to be wiser everyday.

    avatar
    8 Comment threads
    3 Thread replies
    0 Followers
     
    Most reacted comment
    Hottest comment thread
    9 Comment authors
    DomXander marc Sususcokomal aryaLuis PaulAndrew Recent comment authors
      Subscribe  
    newest oldest most voted
    Notify of
    Monali Dhamale
    Guest
    Monali Dhamale

    I have downloaded everything. I stuck this step
    Step 3: Create a new empty database for Magento 2
    On my laptop i don’t get it phpmyadmin page on browser.

    Kislay Komal
    Guest

    Hi Dom, Indeed a great article. I followed the setps mentioned here to install Magento 2.3 on localhost. 1. Frontend: Able to see a page with body text “Home Page” when i open http://localhost/magento/ it looks fine, i am sure when there will be any template set to it, it will be full fledged page. 2. Admin backend panel: http://localhost/magento/admin_pgrz6u/ I can login and see some contents, but all the admin panel menus dont go anywhere, when i click them. neither of the hyperlinks, buttons works on that page so cant actually perform any setup, configuration and unable to move… Read more »

    B
    Guest
    B

    Been throwing my brain against this for hours today. Can get everything correct, but when trying step 4 to install magneto, i get this:
    Autoload error
    Vendor autoload is not found. Please run ‘composer install’ under application root directory.

    However, composer is installed. I have tried every article “fix” found on the net, with no luck. Any adivce where to go next?

    Kien
    Guest

    Hi Sir, I’ve followed all the steps shown above, but i get all these errors and page couldn’t load css/js files properly. (LOCALHOST) –Errors– 127.0.0.1/:1 Refused to apply style from ‘http://127.0.0.1/mage2/pub/static/version1549855875/frontend/Magento/luma/en_US/mage/calendar.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled. mixins.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) require.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) polyfill.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) mixins.js:1 Failed to load resource: the… Read more »

    Andrew
    Guest
    Andrew

    Hi. I have a trouble with step 4 – when i try to request the url to download magento my browser says that object not found

    Luis Paul
    Guest
    Luis Paul

    Hi, it was such a detailed and well-explained article. I highly appreciate your hard work. Before this blog post, I have found another that was really effective https://magenticians.com/install-magento-2-on-localhost-using-xampp/. But you had added value by explaining the XAMPP installation process. So, well done! keep up the same pace

    komal arya
    Guest
    komal arya

    Hello i installed the magento and everything was perfect but when click the admin link and it’s blank like black screen?

    Xander marc Sususco
    Guest
    Xander marc Sususco

    Can I ask the laptop or system requirements of magento2? I’am a college student and Ia want to use it in my thesis about ecommerce