How To Install Latest Magento 2 Version Using Composer

by Syed Muneeb Ul Hasan  December 27, 2016

Magento 2 was introduced a while back and has already created quite a buzz in the ecommerce industry. Online merchants have already started installing and setting up their e-stores before the holiday season rush. If you are wondering how you can easily install Magento 2 on Cloudways, then follow this simple, step-by-step guide on installing Magento 2 using Composer.

Install Magento 2 Composer

In this article, I’m gonna show you how to install Magento 2 on your Cloudways server using composer.

Ready?

Let’s begin!

Prepare your server for Magento 2 installation.

Step 1: Login to Cloudways with your Username and Password. Signup on Cloudways, if you don’t have an account yet.

login cloudways

Step 2: After login, create a server and select Magento from Select Application drop down.
Provide details for your server and application.

Select Application Cloudways

Step 3: Select Cloud provider of your choice. In this tutorial, we are using DigitalOcean.

Select Hosting Cloudways

Step 4: Select your server size according to your requirements.

Note: Kindly select 1GB or above server size. Magento stores hosted on less than 1GB server can make your online website slow, resulting in loss of customers.

server size Cloudways

Step 5: Select your server location by keeping the latency factor in mind.

location

Now click on Launch Server button from the bottom of the page and wait for your server preparation.

Launch Server

Now go to your application and click on Launch Database Manager under Access Detail.

Launch Database

After launching database manager, select all the tables and click on Drop.

Drop Database

Go to your server and click on Launch SSH terminal under Master Credentials.

server

Launch SSH

Magento 2 Installation:

In your “public_html” directory run this command to remove all files.

Now run the following command to install Magento 2 using composer.

Note: To install Magento 2 in the current directory (e.g. public_html) do not forget to add the (.) dot in the end.

public_html directory

Insert your repo.magento.com username and password. For repo.magento.com username and password go to www.magento.com and select on My Account button shown in the top-right corner. After Logging in, go to Developers > Secure Keys and Generate your new SECURE KEYS.

Magento SECURE KEYS

  • Public Key: Is your username
  • Private Key: Is your password

Magento Secure Key

After inserting your repo.magento.com username and password, it will ask for store credentials. Type “Yes”.

Magento 2 Installation

Magento 2 will now start downloading in your server.

Magento 2 Installation

After downloading, it will want your “GitHub OAuth token

Magento 2 Installation

You have to create it from your GitHub account (github.com). For this, Go to Settings > Personal Access tokens and Generate new Token. Copy the token and provide it to the composer. After inserting “GitHub OAuth token”, you should see the following screen.

Magento 2 Installation

Magento 2 is now installed. You now need to set proper permissions for your Magento 2 Store. Magento has few sets of recommended permissions which we have to apply.

a ) Owner must have full access to files.

b ) Web Server must have write permission on var, app/etc and pub directory.

c ) Execute permission of bin/magento.

To do this, go to your Application Management and click on Reset Permission under Application Settings.

Reset Permission

Now just launch your website and click on Agree and Setup Magento.

setup magento

Now just follow all these steps.

steps

For database Configuration, you can get all the details from Application Management under Acces Detail.

database config

After a successful installation of Magento 2 on your Cloudways server using composer, this is how your Magento 2 Frontend and Backend should look like.

Magento 2 Installation

Magento 2 Admin Login

admin page

Note: If you have installed Magento 2 using composer and want to configure Varnish on it, then follow this tutorial How To Setup Magento 2 With Varnish.

There you have it!

Your very own Magento 2 store is now ready for customizations! Add products and improvise according to the holiday season to reap the benefits that Cloudways’ Managed Magento hosting on Cloud has on offer!

Recommendation: I will recommend you to install Magento using 1-click installer as Cloudways offers 1-click installation for Magento 2. The installation is powered by a very high performance stack that is further supported by cache technologies including Varnish and Redis.

Start Creating Web Apps on Managed Cloud Servers Now!

Easy Web App Deployment for Agencies, Developers and E-Commerce Industry

About Syed Muneeb Ul Hasan

Syed Muneeb Ul Hasan is a Magento Community Manager at Cloudways. An expert in PHP and Magento, he prefers to educate users in the implementation and usage of cloud based Magento Hosting Solutions. When not working, he loves to watch cricket. You can email him at muneeb.hasan@cloudways.com

Stay Connected:

You Might Also Like...

  • Thanks for sharing informative guide about Magento 2 Installation

  • Danil Panfiloff

    [master_aanekaunqv]:public_html$ rm -Rf *

    rm: cannot remove ‘media/captcha/admin’: Permission denied

    rm: cannot remove ‘media/captcha/base’: Permission denied

    rm: cannot remove ‘var/report/279366163491’: Permission denied

    rm: cannot remove ‘var/report/541271830307’: Permission denied

    How to delete this file???