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.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

How To Install Magento 2.X On Debian Server

Updated on  19th August

7 Min Read
Reading Time: 7 minutes

Magento uses PHP, which means that the Magento platform is an open source ecommerce application that many merchants use to operate their stores. On most of the Linux distributions, it operates using the LAMP stack. Magento is a resource-intensive application that needs at least 1GB if the store is small, but 4GB for medium to large stores.

Magento Debian

Magento 2 has been released with more functionalities and the back end interface has been improved. A front-end library was also introduced.

Previously, I had written an article on Magento 1.x installation on Debian Server, and now in this tutorial, I am going to show you how to install Magento 2.x on Debian server.

Why Use Cloud for Magento 2?

Choosing a Magento Hosting solution may be a terribly troublesome conundrum for several online businesses. On top of providing customers with the best ecommerce functionalities, several web hosting service suppliers are also capable of providing you with a web server to host your website, together with an email server and different standard web-hosting options. However, if you would like real, quick, and secure ecommerce hosting, you can use cloud infrastructure providers, like AWS, DO, GCE, and Vultr.

Cloudways Magento Hosting For Developers

Getting Started

In order to install Magento 2, you first have to install the MySQL database. And then make a database for your application.

To set up the database, the steps are mentioned below:

1. Create the Database

First, log into the MySQL root account by using the following command:

After this, the system will ask you the password. Simply enter the correct password that you set during installation of MySQL and you are then taken to MySQL command prompt. Now create your database. You can name your database whatever you prefer. I have named it mage2_db

This command will create a database for your Magento 2 system.

PS: Don’t forget to put (;) semicolon at the end of every MySQL command.

2. Create the User Account

Now you have to create a user account for the database to operate the newly created database.

Again, you can name your user account whatever you want and can set a password as you prefer. Mine will be mage2_user for the account name and password is fayyaz. The more secure the password more secure your database will be

3. Granting Privileges

We are done creating the database and user account, especially for Magento. Now you need to set up the privileges for the user you just created. To grant all the privileges the command is:

4. Flush the Privileges

After the above step, your user has access to the newly created database. You need to flush the privileges so that MySQL will get to know about the privileges that we have granted to the newly created user on the newly created database. After flushing out, just exit out of the MySQL command prompt.

After exiting, you will get back to SSH command prompt. And your database has successfully finished installing at this point.

After exiting, you will get back to SSH command prompt. And your database has successfully finished installing at this point.

Downloading Magento 2

Now, get ready to download and install the Magento 2 files. It is recommended that you download the latest version. The reason for downloading the latest version is that it often includes the important security updates in addition to improved new features. The following are the steps for setting up the files.

1. Extract the Files

Use wget to download the Magento 2 files and archive to your home directory.

Now extract the zip file using this command.

Run “’composer install” command under your Magento 2 directory. Or if you face error in installing composer, use these two commands below to install required extensions for Magento 2:

After this, make sure you have changed the value of “always_populate_raw_post_data = 0.” in -1 in your PHPini file.

Note: There is an easy way to edit the php.ini file. Follow the below commands:

To save your editing in php.ini file, simply enter:

2. Assigning Ownership

Now you need to assign the ownership of the files and folders to Apache’s user and group. To do so, the command is:

P.S. Take care of the case-sensitivity here. “R” should be capital.

After this command is run successfully, you have allowed the Apache server to create and modify these files.

Carrying on With Frontend

To complete the installation, you now need to configure it through the web interface. To access the interface, you have to open up your browser and then type in the server’s domain name or public IP address in the address bar.


I will now tell you about all the pages, step by step.

1. Welcome Page

Now, if the above steps have been completed successfully, your Magento 2 system will allow you to access this welcome page to set up the Magento installation. On this page, you will need to hit the Agree and Setup Magento button.

Welcome Page

2. Readiness Check

On this page, the system checks whether your system is up to date for Magento 2 or not. Hit the Start Readiness Check button and if it is successful, then click the Next button at the top.

Readiness Check

3. Add Database

On this page, enter the database information that you just entered creating one above.

Add Database

Database Server Host: Your host here should be localhost.

Database Name: Make sure that you put the name of the database that you decided during the creation of the MySQL database.

Database Server User Name: Put the username that you decided during the creation of the user account.

Database Server Password: Fill in the password that you put during the creation of the user account.

Tables Prefix: This field is optional. If you want to put any prefix before the table names, then fill out this field.

After filling the above fields, you have to jump to the second section by clicking the Next button.

4. Web Configuration

Web Configuration

This page allows you to enter the information about the store and the admin:

Your Store Address: Enter the address of your store that is entered into the browser to reach the front of the store.

Magento Admin Address: Enter the admin address which is entered into the browser to reach the admin panel.

After filling the above fields, you have to jump to the second section by clicking the Next button.

5. Customize Your Store

Select the Time Zone, Currency, and Language to set up your store.

Customize the Store

After filling the above fields, you have to jump to the second section by clicking the Next button.

6. Create Admin Account

Create Admin Account

Enter the information required:

New Username: Enter the name of the admin of your store.

New Email: The email address of the admin.

New Password: The password which the admin uses to enter the account.

After filling the above fields, you have to jump to the second section by clicking the Next button.

7. Install

All you have to do on this page is to click the Install button and the installation will begin.

If you want to see the installation process click below at Console Log.

8. Success

After the Magento 2 installation is done successfully, it is ready to use.


Put your public IP or the domain name on the address bar of the browser and see the front of your store.

If you have successfully configured the above steps, you will be directed towards the Home Page of your Magento 2 store.

Home Page

Also, you can visit this page by just using the command


To see the dashboard, you just have to log in to the system using the username and password that you have already set above. If the info you provided is correct, you will be redirected towards the Magento 2 admin dashboard that will look like this.

admin dashboard

After going through all the steps above, your Magento 2 store is set up on the Lamp Stack and is ready to go. Now you can use it and start operating your Magento 2 store so that you can sell your products and delight your customers. Also, now you can set up the promotions for your store.

Which Provider Is the Best?

This tutorial has given you a brief idea of choosing cloud hosting for your Magento 2 store, but the question still remains what provider will give the best services. Cloudways provides you only one-click installation of Magento 2 platform, so it will be very easy for you to launch your Magento 2 store on a Cloudways managed the server.

Cloudways is a PaaS supplier that empowers the cloud suppliers and offers you professional expertise with Magento Hosting. Try Cloudways for 14-days trial on DigitalOcean Cloud server. They even have a useful tutorial so that you can install it on your Cloudways server, how to host Magento 2 in the cloud.

Still, if you have questions or want to give feedback, then feel free to contact me. So, what you are waiting for? You have this tutorial, start up your Magento store by following it!

Share your opinion in the comment section. COMMENT NOW

Fayyaz Khattak

Fayyaz is a Magento Community Manager at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. Fayyaz is a food lover and enjoys driving. You can email him at

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

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