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:
- Download and install XAMPP
- Download Magento2 zip file with sample data.
- Create a new database named magento2 in MySQL
- Create a new folder named magento2 (or any name you want) in xampp\htdocs folder.
- Open the following file in a text editor:
- Add following entry in the file:
<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/magento2/" ServerName mag2.com.local </VirtualHost>
This will allow us to call our Magento 2 web application with the URL:
- 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:
- 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.
- 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.