Download and Install Magento 2 using CLI

At the drop of a hat I would like to write this post because, for the developers, downloading and installing Magento is just a frequent and unpredictable task along with his/her routine. Here is handy solution to do the same using CLI, it’s quick and you need not check browser to fill forms and install Magento.

Download magento using composer

composer create-project –repository-url= magento/project-community-edition=[version] [installation_directory_name]

Example : composer create-project --repository-url= magento/project-community-edition=2.2.4 magento224os

composer create-project –repository-url= magento/project-community-edition=[version]+Samples.* [installation_directory_name]

Example : composer create-project --repository-url= magento/project-community-edition=2.2.4+Samples.* magento224os

Create a MySQL database to connect

mysql -u[mysql_username] -p

Start installation

php bin/magento setup:install

php bin/magento setup:install --base-url="" --db-host="localhost" --db-name="magento224os" --db-user="root" --db-password="root" --db-prefix="mos_" --cleanup-database --admin-firstname="Magento2" --admin-lastname="Admin" --admin-email=""  --admin-user="admin" --admin-password="admin123"  --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin" --sales-order-increment-prefix="MOS"

Install sample data after installing magento if required

php bin/magento sampledata:deploy
php bin/magento setup:upgrade

Set Magento2 application to developer mode

php bin/magento deploy:mode:set developer

Create admin user using command line(If you forgot the created one)

php bin/magento admin:user:create –admin-user='[admin_username]’ –admin-password='[admin_password]’ –admin-email='[admin_email]’ –admin-firstname='[admin_firstname]’ –admin-lastname='[admin_lastname]’

php bin/magento admin:user:create --admin-user='developer' --admin-password='developer123' --admin-email='' --admin-firstname='Magento2' --admin-lastname='Developer'

I hope this gonna a small help developers to get,set & go with Magento 2!!!


Post your Queries or Suggesions

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.