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 WordPress on Linux Operating System (A Step by Step Guide)

June 7, 2021

6 Min Read
wordpress linux

So you bought a server from a top-notch WordPress web hosting provider, and now you want to install WordPress on Linux. If you’re not sure how to do that, don’t worry, I am here to help you. Once you’ve gone through this tutorial, the process will be like a walk in the park for you.

Before I go into the details of the process, here are some prerequisites you should keep in mind:

  1. Operating System

When you purchase a server, a pre-installed OS generally comes with it. It is usually a popular Linux distro, such as Ubuntu or Debian. In this tutorial, I’ll be using Debian 9 to install WordPress.

  1. LAMP

LAMP is an abbreviation of the top four technologies that are used inc combination to host and launch a dynamic website. These open-source components are:

  • Linux
    Linux is an operating system for both desktop and server use. It includes the Linux kernel (the core of the operating system) and supporting tools and libraries.
  • Apache
    Apache is a widely used open-source webserver, and according to W3Techs, it powers nearly 35% of websites today.
  • MySQL/MariaDB
    MySQL and MariaDB are two leading open-source database management systems. Both are powered by SQL, a structured query language used to create complex database queries for the DBMS.
  • PHP
    PHP is a well-known open-source server-side web development scripting language. It remains among the top-three most popular programming languages for building web applications.
  1. phpMyAdmin

This is perhaps the most commonly used database management tool in the web dev industry. You can create, alter, delete, drop, import, and export database queries directly using phpMyAdmin.

  1. WordPress

As you may already know, WordPress is a popular CMS that lets you build online stores, blogs, and eLearning sites in a very friendly way. I will be installing the latest WP version (at the time of writing this tutorial, 5.6) in this tutorial.

Installing LAMP

Before installing WordPress on your server, you need to learn how to install LAMP on a Debian Server. While you are thre, you can also pick up how to install phpMyAdmin on Debian.

Download WordPress on Linux

After you’ve successfully installed the LAMP stack on your server, you’ll need to download and extract the WordPress files. You’ll need to access your server via SSH. In this example, I’ll be using PuTTY to connect to the server.

Log in to Server

Launch PuTTY, provide the server IP, port, and the username.

putty login

 

After that, go to Connection > SSH > Auth, browse to your private key file for authentication, and click Open.

putty ssh auth

Provide your login credentials to get into the server. After successfully logging in, you’ll see a screen similar to this:

terminal

 

Navigate to the html folder by using this command:

cd /var/www/html

change directory

 

Inside the folder, I’ll create another folder named ‘farhan’. Then, I’ll download, extract, and install WordPress within the newly created folder. Type the following command to create the folder within the html folder:

sudo mkdir farhan

make directory

 

Get into the folder by using:

cd farhan

 

Now download the WordPress Files using the following command:

sudo wget https://wordpress.org/latest.zip

downlaod wordpress

 

Once you’ve downloaded WordPress, extract the files by using this command:

unzip latest.zip

unzip folder

 

Once the extraction process is complete, you’ll see a new folder named WordPress containing all WordPress files. You can see a full list of extracted files by typing:

ls

list of folders

 

Install WordPress on Debian

Now open your browser and navigate to the WordPress installation by typing the server’s IP address along with the WordPress folder path. In my case, the folder path is:

http://34.125.xxx.xxx/farhan/wordpress

wordpress setup

As you can see, it is asking for connecting a database. Since I have already set up phpMyAdmin, I will use the credentials to connect the database to the WordPress installation.

Create WordPress Database Using phpMyAdmin

Navigate to the phpMyAdmin directory by typing this URL in a browser tab:

 

http://34.125.xxx.xxx/phpmyadmin/

phpmyadmin login

Log in with the SQL credentials and create a database. I’ll create a database named farhandb for this tutorial:

database on phpmyadmin

Once the database has been created, go to the SSH terminal and open the WordPress folder with cd command.

cd wordpress

change to wordpress folder

 

Then, use the following command to create a new wp-config.php file by making a copy of  the wp-config-sample.php.

sudo cp wp-config-sample.php wp-config.php

copy config file

After that, open the newly created wp-config.php file and edit the three values (database name, username, and password).

To open and edit the wp-config file, use the following command:

sudo nano wp-config.php

edit file

Then, define the database name (created earlier), username, and password. Once the changes are done, press “CTRL + x” to exit, then “Y” to save the changes.

change values in wp config file

The next step is to go to the browser and navigate to the WordPress installation folder. In my case, the URL is:

http://34.125.xxx.xxx/farhan/wordpress/

Then, simply run the installation wizard and fill in the necessary information to finalize the installation process.

wordpress installation

By now, you should have successfully installed WordPress on Debian powered server. I know it’s slightly technical to install WordPress on Linux distributions, but I hope this tutorial will simplify the process for you. In general, the steps of the process are:

  • Install LAMP
  • Install phpMyAdmin
  • Download & Unzip WordPress
  • Create a Database through phpMyAdmin
  • Give special permission to the WordPress directory
  • Install WordPress

As you can imagine, this process of installing WordPress on Linux takes some time to complete and in case of any mishaps, you have to start all over again.

You can easily avoid all this hassle by signing up for a Cloudways account. You will get a managed WordPress hosting platform that lets you skip all the steps and provide you with a 1-click WordPress install.

Here is a peek at how easy it is to launch and install WordPress on Debian on the Cloudways Platform:

Why Cloudways?

You might be wondering why I am recommending Cloudways here? Well, to be honest, the above-mentioned manual installation of WordPress can be tricky sometimes. In addition to the easy installation, you get:

Ease of Use & Peace of Mind

Cloudways lets you enjoy the benefits of cloud hosting without going through all the hassles of getting into the nitty-gritty, and all server related queries are just a click away. If you have any questions, simply launch a live chat session.

Optimized Stack

All servers launched at the Cloudways Platform come pre-installed with LAMP and supporting technologies such as NGINX, Varnish, Redis, and Memcached, etc. Here is what the Cloudways stack looks like:

cloudways stack

WordPress sites hosted on Cloudways load in just a few milliseconds. You can find guides for the entire testing environment and the test results below:

Curious to see how simple and easy to use Cloudways Platform is? Here is an extensive walkthrough of Cloudways.

Don’t forget to share this article if you found it helpful. And if you have any queries, leave a comment below, and we’ll get back shortly!

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Beautifully optimized hosting for WordPress and Magento”

Arda Burak [Agency Owner]

Farhan Ayub

Farhan is a community manager at Cloudways. He loves to work with WordPress and has a passion for web development. Mostly, he spends his time interacting with the people in the WordPress community. Apart from his work life, Farhan spends his time gaming and playing sports. Feel free to 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!