Magento is the most popular open-source e-commerce CMS which is written in PHP language and used by merchants to sell their products and grow their online stores.
Initially it looks like the installation of magento is a very tough process and for it some expertise is required but by following the below steps you can install magento in your local environment within a few hours.
- Server Setup: Before installing the magento you need to set up your server. For the local environment you can install XAMPP, WAMP etc.
- Configure php.ini: Enable the below php extensions which are required to install the magento. bcmath, ctype, curl, dom, gd, hash, iconv, intl, mbstring, openssl, pdo_mysql, simplexml, soap, xsl, zip, ext-sockets
- Configure PHP Settings: In php.ini file, search and change the following values as below:
- Download Elasticsearch: For magento latest versions elasticsearch is required. So Download elasticsearch from “https://www.elastic.co/downloads/elasticsearch”. Unzip the downloaded archived file at the location “xampp\htdocs\”. Now right click on the elasticsearch.bat file within the “xampp\htdocs\elasticsearch\bin” folder and select administrator.
- Download Magento: Download the magento from the magento official site. You can download magento with sample data or without sample data. After downloading, create the folder named “magento” at “xampp/htdocs” location and extract all the magento downloaded files within this folder.
- Create Database: Create a database in which all the magento tables will be stored on/after installing the magento.
- Install Magento: To install the magento you have to run below cmd command:
- If you get the error like below:
- Now if you go to your browser with this URL to access Magento 2 store: http://yourname.magento.com(In my machine, I have setup to http://localhost/magento) and you see a blank page then follow the below:
- Copy the “index.php” and “.htaccess” files from the pub folder and paste into the root directory. Both files are in the pub folder when we download the setup for security purposes, but we’ve to follow this step while installing in the local.
- Replace “require __DIR__ . '/../app/bootstrap.php';” with “require __DIR__ .'/app/bootstrap.php'; ” in the index.php file that we’d paste in the root directory.
- In db “core_config_data” table insert following data:
- If images are not showing in magento frontend: Run below command to resize all images: php bin/magento catalog:images:resize
- Disable TwoFactor auth module to stop two factor authentication in magento admin: Disable this module by running below command: php bin/magento module:disable Magento_TwoFactorAuth
- If magento admin login doesn’t work on localhost follow the below steps: