magento 2 composer install

Install Magento using composer

Magento 2 composer install is a process to install Mage on your hosting server. Here we will discuss the easy and friendly ways to do it correctly.

Mage official also has details on the Mage installation using composer. But for installing composer users might need to go through a large document. So here we will try to make the process simpler, rather a step to step guide to install Mage using composer.

We need to follow these below steps to setup Mage correctly on hosting server.

Step 1: Installing the composer (Window OS)

In this occasion, visit the link to download the composer. Later we need to run the composer setup.exe file. The setup.exe file will install the latest version of composer. Also set up the PATH to call the composer from any directory using command line.

Note: Before you get started, close all other terminals. Because the Path only loads with the terminal so test with a new terminal.

Manual – Magento 2 composer install

Although for the manual installation you need to download composer.phar . Therefore, change to a DIR on path and also follow the Download Page directions to download correctly.

Alongside with composer.phar just make a new composer.bat file.

C:\bin>echo @php "%~dp0composer.phar" %*>composer.bat

Next if the DIR isn’t available, add DIR to the PATH environment variable. Also, for information on changing your PATH variable, please see this article and/or use Google. Here you can also browse internet to learn about “How to change your path variable?”.

Now close the recent terminal. Then use a new terminal to test .

C:\Users\username>composer -V

Learn more about installing composer on Linux, Unix & OS etc.

Step 2: Downloading Mage

Then use this following command and run into ROOT DIR to download Mage.

composer create-project --repository-url= magento/project-community-edition

Step 3: Mage  permissions

Now we have to setup correct permissions to Mage 2 ROOT DIR. The recommendations are 700 for directories and 600 for all files from Mage official. You can follow our article on Mage permissions.

find . -type d -exec chmod 700 {} \; && find . -type f -exec chmod 600 {} \;

Step 4: Database for Magento 2 composer install

Assume you have all correct permissions along with a MySQL user. Now create a new database for operations. Though we can also use an existing database. During the installation process take a table prefix but that’s not a familiar way to do it.

echo "CREATE DATABASE magento2" | mysql -u[mysqluser] -p

 Step 5: Install Mage

5.1 Automate with Aspiration Hosting

Now hit your browser and go to Aspiration Hosting. Then under your cPanel use one click Mage installer for a hastle free setup process. Furthermore, we are providing Mage servers with SSD cloud for optimum online experience. However enjoy our plan starting from $9.99 per month. Specially the plans comes with all development supports 24×7.

Otherwise you may also use other hosting services according to your web store.


5.2 Manual installation

However the command lines needs changes.  Because every store is different from another. Now under the ROOT DIR run these command lines to install Mage.

php bin/magento setup:install
--db-host="name localhost"
--db-name="name DB"
--db-user="db username"
--db-password="db password"

Finally,thank you for having patience. Hence enjoy using Mage stores.

Mehedi Hossain Chowdhury BSC EE for Aspiration Hosting