We know it is challenging to install the Magento software. We would like to help you by simplifying the process as much as possible.
There are two method to install Magento 2 on localhost.
- Using Composer
- Using CLI(Command Line Installation)
1. Using 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.
The Following Step to Install Magento.
Step – 1: Create the Magento file system.
Step – 2: Install the composer.
Step – 3: Obtain authentication keys for the Magento code repository.
Step – 4: After go to your magento root directory. And open cmd.
Step – 5: Go to your magento root directory at the command prompt.
Step – 6: Run this following command.
For Magento Open Source
$ composer create-project --repository-url=https://repo.magento.com/magento/project-community-edition |
For Magento Commerce
$ composer create-project --repository-url=https://repo.magento.com/magento/project-enterprise-edition |
When prompted, enter your Magento authentication keys. Public and private keys are created and configured in your Magento Marketplace.
2. Using CLI(Command Line Installation)
A command-line interface processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.
Step – 1: Downloading an archive file From Download Magento.
Note: Allows you to run Magento software on a local server. You can download in either zip or tar format. You can also choose to include sample date, or not, with your download. This is a relatively simple installation method, but it lacks many of the advantages of using Composer. If you may need any of the Composer features noted above, we recommend you use that method instead.
Step – 2: Extract this archive file in following path.
For ex. C:\xampp\htdocs
Step – 3: After go to your magento root directory. And open cmd.
Step – 4: Go to your magento root directory at the command prompt.
Step – 6: Run this following command.
Note: For more detailed about CLI installation visit this link More Detail
$ php bin/magento setup:install --base-url="http://localhost/your-directory-name" --db-host="localhost" --db-name="your-db-name" --db-user="username" --db-password="your-password" --admin-firstname="admin" --admin-lastname="admin" --admin-email="admin@admin.com" --admin-user="admin" --admin-password="your-password" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" |
Note: You can customize the Admin URI with the --backend-frontname="name"
option. However, we recommend omitting this option and allowing the installation command to automatically generate a random URI. A random URI is harder for hackers or malicious software to exploit. The URI displays in your console when installation is complete.