WordPress

How to install WordPress on Ubuntu Server

Free and open-source software is always appreciated by computer users. One of the benefits of these programs is that they do not cost you anything. Many of these programs are very secure and are tested and regularly improved by users, who keep the security of your company intact for you.

This article covers two such software programs: Ubuntu and WordPress. WordPress is a system that creates and edits content and is used to make websites and write blogs. Meanwhile, Ubuntu is an operating system software on which the whole system runs. This article shows you how to install the WordPress software in Ubuntu.

However, before moving on to install WordPress, you first need to set up some of the background software. To do so, you will need to install three things before installing WordPress. The first one is a dynamic content processor, the second is a webserver, and the last one is a database server. To get these things, you will download Apache, MySQL, and PHP before downloading WordPress.

Install Apache

WordPress is usually installed using the LAMP framework. In LAMP, L stands for Linux, A stands for Apache, M stands for MySQL, and P stands for PHP. First, you will install an SSH client on the system. You will be using the SSH username and password to log in. After you obtain access, you will be shown a welcome message. Enter the following two commands to install Apache:

$ sudo apt-get update

$ sudo apt-get install apache2

Install MySQL

MySQL is an essential software for WordPress that comes with a lot of benefits. Before installing WordPress, you first need to install MySQL, just as the webserver. This section teaches you how to download a version of MySQL called MariaDB, a fully open-source software.

Use the following commands to install MariaDB in Ubuntu. Both MariaDB and its client version will be downloaded once you enter the first command. The second command allows for the initiation of the MySQL service, and the third command enables the service. The last commands ensure that the installation is stable. You will be prompted with some questions; be sure to give the database server a root password so that you can use the key for the questions later.

$ sudo apt install mariadb-server

$ sudo systemctl start mysql
$ sudo service mysql start
$ sudo /etc/init.d/mysql start

$ sudo systemctl enable mysql
$ sudo apt-cache policy mysql-server

$ sudo mysql secure installation

Install PHP 8

PHP also needs to be downloaded with WordPress. PHP is the language used in WordPress to run and decipher the PHP scripts used in WordPress. This section explains how to install version 8 of PHP in Ubuntu.

The following commands are used to install PHP8. The first command installs the core module and supporting modules of PHP8, while the other commands enable the web module and restart the Apache server, respectively.

$ sudo add-apt-repository ppa:ondrej/php

$ sudo apt install php8.0 libapache2-mod-php8.0

$ sudo systemctl restart apache2
$ sudo apt install php8.0-fpm

$ sudo systemctl restart nginx

Install WordPress

The final step in this process is to install WordPress. This requires a lot more time than the previous installations, but it will be easy if you just follow the instructions provided in this section.

First, open the SSH client and use the commands given below. The first command enters the MySQL interface. The second command creates the database and enables the UTF8 character format, thus enabling the Unicode texts without becoming corrupted. The third command creates a new username, along with its password. Finally, the fourth command saves the changes made, and the fifth command exits the MySQL interface.

At this stage, WordPress is installed. Use the following shell commands to do so. The first command sends the user to a folder that is made temporarily and whose job is to keep the WordPress download files. The second command installs the files. The third command extracts the installed version, and the fourth command replicates the config file. Finally, the fifth command adds a new folder.

At this point, you have installed the file server for WordPress. Now, you must configure and highlight the owner information. Use the following commands to do so. The first command gives the user an HTML folder for downloading gradients, backgrounds, and plugins directly. The second command sets the flag to the mini folders of the HTML folder.

Next, you will configure the settings. The commands you use here will tell you how to configure the wp-config.php. The first command generates salt values to secure the WordPress installation. The second command opens an actual wp-cnfig.php file.

$ curl –s https://api.wordpress.org/secret-key/1.1/salt/

$ nano /var/www/html/wp-config.php

Once you have issued the commands given above, you will install the WordPress website on the webserver. Use your domain (or your IP address) to do so. When you type the domain into the search bar, the following window will be displayed. Simply click “Continue” to proceed further with the installation.

Finally, you will use the Site Title. You will also need to provide an email address to verify the account, as well as for recovery purposes. After you have entered all the necessary information, click “Install WordPress,” and WordPress be installed onto your system.

Conclusion

This article showed you the step-by-step procedure for installing and configuring WordPress on Ubuntu, so you can do it yourself now from scratch.

About the author

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.