Quick and Easy Guide: Installing and Setting Up WordPress on Linux VPS

Administration 10 min read

According to statistics, the vast majority of sites on the Internet are hosted on servers running Unix-like systems, most often the Linux family. This is motivated by the fact that console server operating systems spend a minimum of server resources on maintaining their own work, which greatly improves the performance of the web server compared to servers, for example, on Windows, of course, all other things being equal. this is especially important when hosting a site on a Virtual Server (VPS), as it is usually limited in resources to ensure a competitive rental price.

Also, the most popular control panel for creating websites, at the moment, is the well-known WordPress. It is a very powerful system that has many features and benefits, but at the same time it is easy to get acquainted and start working with it. It allows you to create your first website in just minutes.

If you are considering hosting your WordPress site on a Linux Virtual Private Server (VPS), then this article should help you! In this detailed article, we will walk you through the process of installing and setting up WordPress on a Linux VPS (Ubuntu/Debian) step by step so you can get your first website up and running in no time.

Step 1: Choosing the Right VPS Provider

Before we dive into the setup process, it's important to choose a reliable hosting service provider, specifically VPS, that suits your needs. Look for a provider that offers a user-friendly control panel, great customer support, and the right amount of resources for your website requirements. You can read more about how to choose a quality hosting provider in this article.


Step 2: Accessing Your Linux VPS

After signing up with your chosen VPS provider, you'll receive an email with your server's login credentials, including the IP address, username, and password. Use an SSH client like PuTTY (for Windows) or Terminal (for Mac and Linux) to access your VPS remotely.

Open a terminal and enter the following command, where your_username is the login you received in the email, and your_server_ip is the server's IP address, respectively:

ssh [your_username]@[your_server_ip]


The server will then ask you for a password. Enter the password received in the letter and press Enter. That's it, you are on the server.


Step 3: Updating System Packages

Once you have access to your VPS, the first step is to ensure that all the system packages are up to date. This ensures that you have the latest security patches and bug fixes.

sudo apt update
sudo apt upgrade


Step 4: Installing LAMP Stack

To run WordPress on your Linux VPS, you need to set up the LAMP (Linux, Apache, MySQL, PHP) stack. Apache will be the web server, MySQL will handle the database, and PHP will be used to process dynamic content.

sudo apt install apache2
sudo apt install mysql-server
sudo mysql_secure_installation
sudo apt install php libapache2-mod-php php-mysql
sudo systemctl restart apache2

!Important! When installing the MySQL database server - you will be asked to enter an administrator password. Write it down or remember it well, it will come in handy later when working with the database console.


Step 5: Create MySQL Database and User

Next, create a MySQL database and a user to install WordPress. This step is critical as it will store all of your website data in the database.

sudo mysql -u root -p
CREATE DATABASE wordpressdb;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'localhost';


Step 6: Downloading WordPress

Navigate to the Apache web root directory and download the latest version of WordPress.

cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz


Step 7: Configuring WordPress

Rename the sample configuration file and provide your MySQL database details.

sudo mv wp-config-sample.php wp-config.php
sudo nano wp-config.php


Modify the following lines in wp-config.php file:

define('DB_NAME', 'wordpressdb');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');


Save and close the file.


Step 8: Setting File Permissions

Ensure that proper file permissions are set for WordPress to function correctly.

sudo chown -R www-data:www-data /var/www/html/
sudo find /var/www/html/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/ -type f -exec chmod 644 {} \;


Step 9: Finalizing WordPress Installation

Now, you can complete the installation process by accessing your website through a web browser. Enter your domain name or server IP in the address bar, and you will be greeted with the WordPress installation wizard.

Follow the on-screen instructions, including creating an admin account and entering your website's title.


Congratulations! You've successfully installed and set up WordPress on your Linux VPS. With this powerful combination, you can now create and manage your WordPress website with complete control and enhanced performance. 

2023-07-26 10:02

Bitcoin Cash