This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How To Install Latest Magento 2 Version Using Composer

September 17, 2021

5 Min Read

Magento 2 has already created quite a buzz in the ecommerce industry. Online merchants and Store Owners have already started installing and setting up their Ecommerce stores before the holiday season rush. However, sometimes, it becomes hectic to install and manage a store in such a sales spike.

Magento 2 uses Composer to manage its components and their dependencies. Using Magento 2 Composer to get its software metapackage, has the following advantages:

  • Reuse third-party libraries without bundling them with Magento 2 source code.
  • Reduce magento extension complexity and compatibility issues by using a component-based architecture with robust dependency management.
  • Adhere to PHP-FIG (Framework Interoperability Group) standards.
  • Repackage Magento 2 code with other components.
  • Use Magento 2 in a production environment.

If you are wondering how you can easily install Magento 2 using Composer, then follow this simple step-by-step guide on installing Magento 2 Composer.

Ready? Let’s begin!

Prepare your Server for Installing Magento 2

Step 1: Create an Account

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

Cloudways Platform Login

Step 2: Select Magento Application

After login, create a server and select Magento 2 version from the Select your Application dropdown. Also, provide details for your server and application name.

Select Magento Application


Step 3: Choose Cloud Providers

Select the Cloud Provider of your choice. In this tutorial, we are using Amazon AWS.

Select Cloud Server

Step 4: Select Server Size & Bandwidth

Select Server Size & Bandwidth according to your requirements.

Choose Server Size & Bandwidth

Step 5: Define Server Storage

Now, select your Server Storage. You can always scale up or down whenever required.

Set Application Web Files & Database

Step 6: Select Nearest Server Location

Select your server Location by keeping the latency factor in mind.

Choose Server Size

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 Details.

Application Access Detail Dashboard

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

Drop Database Dashboard

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

AWS Server Launched



Launch SSH Terminal

How to Configure Magento 2

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

rm -Rf *

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

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

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 username and password. For username and password, log in to Magento Marketplace and select My Account from the top-right corner. Now click Access Keys and Generate your new SECURE KEYS.

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

Scalable, Super Fast, & Secure Magento Hosting

Our Clients Love us because we never compromise on these features

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

Magento 2 Installation

Magento 2 will now start downloading on 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 ( 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 ) The 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.

Application Reset Permission

Now just launch your website and click on Agree and Setup Magento and just follow all these steps.


Magento Installation Steps

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

Database Credentials

Let’s Check Out the New Magento 2 Application

Magento Frontend

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


Magento Application Login Credentials

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

Final Words

This is everything on how to install Magento 2.

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 Magento Managed hosting on Cloud has on offer!

Recommendation: I will recommend you to check our 1-click installer telling about how to install Magento 2 effortlessly. The installation is powered by a very high-performance stack that is further supported by cache technologies including Varnish and Redis.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Great speed, features, knowledgebase, dashboard, UX and fast, expert support. Very happy!”

Stefan [Management Consultant]

Fayyaz Khattak

Fayyaz, a passionate Motorbike tourist, works as a Team Lead — Magento Community at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. You can contact him at [email protected]


Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!


Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!