In this article, we are going through the steps of installing WordPress CMS on a server that has already been prepared. We have so far set up the operating system environment, and all the services needed for a web server to serve the web traffic.
ip: 167.71.34.152 (replace it with your server ip)
OS: Ubuntu 23.10 (GNU/Linux 6.5.0-9-generic x86_64)
User: bg-user
Login to the server
MacBook-Pro-ID:~ ivan$ ssh [email protected] -i bluegrid.io-eduSince we know where our DocumentRoot is (location of the website files):
bg-user@bluegrid:~$ cat /etc/apache2/sites-enabled/000-default.conf | grep DocumentRootExample result:

We’ll go ahead and download the WordPress installation into the DocumentRoot location and perform the following:
- Navigate to the
DocumentRootlocation:
bg-user@bluegrid:~$ cd /var/www/html/- Get the latest WordPress installation package:
bg-user@bluegrid:/var/www/html$ sudo wget https://wordpress.org/latest.zipExample result:

- Since we have downloaded zip file we need to unpack it. However, let’s first install two small tools we might need in the future:
zipandunzip:
bg-user@bluegrid:/var/www/html$ sudo apt-get install zip unzipNow unpack latest.zip:
bg-user@bluegrid:/var/www/html$ sudo unzip latest.zip And check where it unpacked it to:

- We want to have all the WordPress files directly in the
DocumentRootlocation and not in the subdirectory:
bg-user@bluegrid:/var/www/html$ sudo mv wordpress/* ./Let’s see it now:

Now that we have WordPress unpacked we can proceed and configure it to connect to the database by editing the wp-config.php. You may notice there might only be a wp-config-sample.php instead. This sample file is there to help us generate the wp-config.php so let’s make it a copy of the sample file:
bg-user@bluegrid:/var/www/html$ sudo cp wp-config-sample.php wp-config.phpNow let’s open wp-config.php and setup the database connection like this:
define( 'DB_NAME', 'bluedb' );
/** Database username */
define( 'DB_USER', 'bg-wp' );
/** Database password */
define( 'DB_PASSWORD', 'bgpassword' );We can now open the final steps in installing WordPress through browser using ip address of the server:

Notes:
- I use
NordPassas a password manager that generated the suggested password in the example - Discouraging search engines is important until we have a website that is safe to index. Until then we should keep it away from the eyes of search engines.
From this point, the WordPress website is installed and now we have to make sure HTTPS support is installed.