In this post, we will see how to setup Magento2 on a Windows machine.

We will be using XAMPP for this. Here are the steps:

  1. Download and install XAMPP
  2. Download Magento2 zip file with sample data.
  3. Create a new database named magento2 in MySQL
  4. Create a new folder named magento2 (or any name you want) in xampp\htdocs folder.
  5. Open the following file in a text editor:
  6. Add following entry in the file:
    <VirtualHost *:80>
       DocumentRoot "C:/xampp/htdocs/magento2/"

    This will allow us to call our Magento 2 web application with the URL:
  7. Now, we will tell our operating system about our new URL which should be executed on localhost. Open the following file in a text editor as administrator:

    Add following line to it:
  8. Next, we will run the Magento2 installer by visiting the following URL in our browser:

    I assume Apache and MySQL are running and we already created our database.
    Installation is an easy process and you just have to fill some values like database name, mysql user etc.
    The installer might tell you to make some changes to your xampp\php\php.ini file.

  9. After installation, simply restart Apache in XAMPP and visit the URL:

    You might see images missing and various errors in console. To fix this, start command prompt and move to your magento2 folder. Now execute the following command:

    php bin/magento setup:static-content:deploy

    Remove everything from your var folder and refresh the page.