Undoubtedly, Magento 2 installation process using the wizard in the browser is quite cumbersome and time consuming, especially when we go with sample data. Over to that, we at KiwiCommerce tells you a complete new tactic to install Magento 2 within matters of minutes, and that is with the use of CLI.
Below is a couple of steps that lets you install and run Magento 2 in no time:
Step 1: Download Magento 2.
Here, we can get Magento 2 Files using composer or directly get zip from https://magento.com/tech-resources/download.
Get latest Magento version by running below command in the console.
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <directory>
Or to get a specific version of Magento, add an extra argument in command as below:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition 2.1.7 <directory>
Here <directory> is in which you want to install Magento. If you do not specify <directory> then it creates project-community-edition.
Download direct Zip
We can download Magento 2 full release with or without sample data from https://magento.com/tech-resources/download and extract it where you want to install, Please check below screenshot.
Step 2: Install using CLI
After set up Magento 2 file system, run below command in CLI from Magento 2 root folder to install it quickly.
php bin/magento setup:install \
Check above options in detail below:
|–base-url||Base URL to use to access your Magento Admin and storefront||No|
|–db-host||Your database host. For ex. ||No|
|–db-user||Your database user. For ex. ||No|
|–db-password||Your database user’s password.||No|
|–admin-firstname||Magento admin user’s first name.||Yes|
|–admin-lastname||Magento admin user’s last name.||Yes|
|–admin-email||Magento admin user’s e-mail address.||Yes|
|–admin-user||Magento admin username.||Yes|
|–admin-password||Magento admin user password.||Yes|
|–backend-frontname||Uniform Resource Identifier (URI) to access the Magento Admin or omit this parameter to let Magento generate a random URI for you.||No|
|–language||Language code to use in the Admin and storefront.||No|
|–currency||Default currency to use in the storefront.||No|
|–timezone||Default time zone to use in the Admin and storefront.||No|
|–use-rewrites||1 means you use web server rewrites for generated links in the storefront and Admin.|
0 disables the use of web server rewrites. This is the default.
Here I’ve added some option in above command which I think are required but not compulsory. The above command should be edited to your needs and executed from the Magento 2 root directory. If everything went correct, you will be informed that the installation has been completed.
For more detail please refer this link: https://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-install.html#instgde-install-cli-magento
You’re done! Now you know the complete process to install Magento 2 using CLI, and of course quickly. Even if you’re stuck somewhere, connect us and we will be glad to help you. 🙂