How to Quickly Deploy a WordPress on an Ubuntu Server

How to Quickly Deploy a WordPress on an Ubuntu Server

WordPress is the most popular content management system (CMS) on the market, powering 65.2% of websites, which translates to 42.4% of all websites. It is one of the most user-friendly CMS around. Today we will show you how to deploy WordPress on an Ubuntu server.

Step 1 . Creating the Server

Fast website loading speeds are important for all websites. This is a major reason why a lot of people now choose to host in the cloud using a cloud server. This is a virtual server based on VMWare or in our case vStack — a unique development of HostRooster corporation, which allows you to create a server in 40 seconds.

So, let’s go to the HostRooster website and register there. Authenticate to your account and navigate: vStack cloud -> Servers -> Create Server. Next, choose the operating system, in our case, it will be Ubuntu 20.04 x64. Then choose the location of the server, if you plan to develop the site for customers from Europe, choose the Amsterdam data center.

Then choose the server config. For our test site we will use a virtual server with 2 CPUs, 4 GB of RAM, 60 GB hard drive and 50Mb/s internet connection speed. This configuration will be enough for about 50,000 users per day, which is almost an unattainable dream for a newly deployed website in the first few months. If the number of users increases, you can easily add resources to your server. For this feature, VPS is very good at the initial stage.

We choose the “login and password” authentication and log in to our server by using putty.

Setting up the Ubuntu Server

Before installing WordPress, we need to install a package of server software — the Apache web server and the MySQL database, as well as the PHP language. But before that, we need to update our OS:

sudo apt-get update && sudo apt-get upgrade -y

Installing Apache Web Server

In order to install the latest version of the Apache webserver, enter the following commands:

sudo apt install apache2 apache2-utils

Then add Apache to the autorun and start the service:

sudo systemctl enable apache2

sudo systemctl start apache2

To check if Apache is available online, let’s type in the IP address of your server in your browser. If you are installing a webserver on a local machine, use the address or http://localhost

By default, all HTML documents are located in the /var/www/html directory. We also require the Apache “mod_rewrite” module for WordPress to work correctly. To enable it, run the following command:

sudo a2enmod rewrite

Then restart the webserver:

sudo systemctl restart apache2

Installing the MySQL Database

To install the mysql db, run the command:

sudo apt install mysql-client mysql-server

To complete the setup, run the command:

sudo mysql_secure_installation

The system will prompt you to install a password verification plugin, which will prohibit the use of weak passwords:

Then you will need to change the password and disable access to the superuser account from the network and also disable guest access. So we answer y for all.

Installing PHP

And finally, before you install WordPress on Ubuntu 20.04 — you require installing PHP and a few modules to work with the web server and MySQL database. To do this, run the command:

sudo apt install php7.4 php7.4-mysql libapache2-mod-php7.4 php7.4-cli php7.4-cgi php7.4-gd

To test how PHP works, create a file named test.php in /var/www/html/:

sudo nano /var/www/html/test.php

File text:


Save it and then open http://ip-address/test.php in a web browser. If everything is set up correctly, you will see a page with information about the PHP version. Naturally, as a matter of security, it should be removed after a successful test.

Installing WordPress on the Ubuntu Server

So finally download the latest version of CMS WordPress from the official website:

wget -c

Extract the contents of the archive to your current folder:

tar -xzvf latest.tar.gz

Copy the WordPress files from your current folder to /var/www/html/:

sudo rsync -av wordpress/* /var/www/html/

In order for the web server to work properly with these files, you need to set the correct permissions for them, namely the user and group www-data:

sudo chown -R www-data:www-data /var/www/html/

sudo chmod -R 755 /var/www/html/

And now the installation of WordPress on Ubuntu 20.04 is complete, but there is still left to configure the database connection. To have WordPress open by default, let’s delete the index.html file:

sudo rm /var/www/html/index.html

Creating a Database for the New Website

To create a database, first log in to the mysql management interface, to do so, execute:

sudo mysql -u root -p

Enter the password that you entered during installation, then separately execute the following commands to create the database, user and set the correct privileges for them:

mysql> CREATE DATABASE wp_db;

mysql> CREATE USER 'wpusr'@'localhost' IDENTIFIED BY 'password';

mysql> GRANT ALL PRIVILEGES ON wp_db.* TO 'wpusr'@'localhost';


mysql> EXIT;

Replace wp_db with the desired database name, wpusr with the username, and password with the desired password. The modifier localhost means that you can connect to the database only from local machine.

Configuring WordPress on the Ubuntu Server

Everything is ready to configure WordPress. Type in the ip address of your server where you installed WordPress, or localhost if the paltform was installed on a local computer. In the first window, the program will ask you to choose a language. Then click “Next” and enter the database name, username, and password that you used during db creation.

Finally, all that’s left is to choose a website name, an admin login, and come up with a complex password.

At the end, all that’s left is to log in, and you can use the WordPress content management system you’ve just set up.

Congratulations, Now you can easily create your own website using a bunch of templates, plugins, and a graphical interface. This is where the fun part begins.

Say hello to HostRooster, the ultimate one-stop-shop for all your entrepreneurial needs! From website hosting to freelance services, HostRooster is the platform that puts the power of success in your hands. Think of it as a matchmaker for your dreams and your website – HostRooster connects you with the tools and services you need to bring your ideas to life. No more juggling multiple platforms and providers, HostRooster has got you covered. So why wait? Sign up today and join the ranks of the world’s greatest entrepreneurs. With HostRooster, the sky’s the limit! “Successful people do what unsuccessful people are not willing to do.” – Eric Thomas “Don’t wait for opportunities, create them.” – Anonymous “Success is not final, failure is not fatal: it is the courage to continue that counts.” 

%d bloggers like this: