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 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
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
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.
Click next and select “Install Shell Menus”
In the next step, you would need php.exe path to proceed with the composer setup and provide the path of php.exe
Now click on install to see the final step
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”
Get your Username and Password from Magento.com and click My Account. Now click on Secure Keys under Developers tab on the left hand.
Your Public key is your Username and your Private key is your password.
Now create an empty database with correct permissions in your phpmyadmin.
- Enter your Magento 2 URL in browser e.g. localhost/m2
Click on Agree and Set Up Magento.
Magento 2 will check your environment for readiness. Click on Start Readiness Check.
Now enter your database information that you previously created.
Click next, and you will be asked for web configurations like store URL, admin URL, Apache rewrites and https options.
Click Next, and select your Timezone, Currency and language in “Customize Your Store” section.
Click next, and insert your back-end Admin username, email and password to setup Admin credentials.
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.
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/
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 firstname.lastname@example.org
Convert visitors into buyers on your 100% faster Magento store.
Deploy your Magento stores on optimized Magento hosting servers.