How to install Magento 2?

How to install Magento 2_

In this tutorial,I will explain to you about how to install Magento 2, installation of Magento 2. You can install Magento by using composer as well as command line and web setup wizard.

1.0 Install Magento 2 via Composer :

Composer : Composer is an application-level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.

Get the composer software by following these commands:

Magento Open Source :

$ composer create-project --repository-url= magento/project-community-edition <install-directory-name>

Magento Commerce :

$ composer create-project --repository-url= magento/project-enterprise-edition <install-directory-name>

Ex : $ composer create-project --repository= magento/project-community-edition magento234

After running command need to add Authentication Keys. You can get by:

Login to Magento account > Go to “My Access Keys” > Enter “Name” and generate a new set of keys.

Your public key is the username and private key is password.

Go to Magento root folder and run below command.

Ex : cd magento234

$ php bin/magento setup:install --base-url="http://localhost/magento234" --db-host="localhost" --db-name="magento234" --db-user="root" --db-password="[email protected]#123" --admin-firstname="admin" --admin-lastname="admin" --admin-email="[email protected]" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin"


  • Database name is magento234.
  • Username and password are both admin & admin123.
  • Properties of Magento administrator.
  • First name is mage and the last name is user.
  • Default language is en_US (US English).
  • Currency is USD by default.
  • Default time zone is America/Chicago.
  • Admin Url is admin

Once installed you can run url in browser : http://localhost/magento234

2.0 Install Web Setup Wizard :

Download Magento .zip or .tar.gz or .tar.bz2. Extract in folder and run url in browser.


For example: http://localhost/magento234/setup

3.0 Setup existing Magento :

  • Import Database
  • Clone / Extract the Source code
  • Run composer command. composer update, If not installed then first composer install & composer update
  • To create env.php. php bin/magento setup:config:set --db-user="" --db-password="" --db-name=""
  • To create config.php. php bin/magento module:enable --all
  • php bin/magento setup:upgrade
  • php bin/magento setup:di:compile
  • php bin/magento setup:static-content:deploy -f
  • Change base url in database. Table Name : core_config_data
  • path : web/unsecure/base_url & path : web/secure/base_url
  • Change value : &
  • php bin/magento cache:clean
  • Now open url in browser

🙂 Happy Coding. Keep Liking & Sharing 💻


Tagged , , ,