3. Installing WordPress


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.

Server details for this educational material purpose:

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-edu

Since we know where our DocumentRoot is (location of the website files):

bg-user@bluegrid:~$ cat /etc/apache2/sites-enabled/000-default.conf | grep DocumentRoot

Example result:

bg-user@bluegrid:~$ cat /etc/apache2/sites-enabled/000-default.conf | grep DocumentRoot

We’ll go ahead and download the WordPress installation into the DocumentRoot location and perform the following:

  • Navigate to the DocumentRoot location:
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.zip

Example result:

bg-user@bluegrid:/var/www/html$ sudo wget https://wordpress.org/latest.zip
  • 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: zip and unzip:
bg-user@bluegrid:/var/www/html$ sudo apt-get install zip unzip

Now unpack latest.zip:

bg-user@bluegrid:/var/www/html$ sudo unzip latest.zip 

And check where it unpacked it to:

bg-user@bluegrid:/var/www/html$ sudo unzip latest.zip 
  • We want to have all the WordPress files directly in the DocumentRoot location and not in the subdirectory:
bg-user@bluegrid:/var/www/html$ sudo mv wordpress/* ./

Let’s see it now:

bg-user@bluegrid:/var/www/html$ sudo mv wordpress/* ./

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.php

Now 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:

WordPress installation information needed

Notes:

  1. I use NordPass as a password manager that generated the suggested password in the example
  2. 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.

Book our WordPress developer
Share this post

Share this link via

Or copy link