[21] How to install WordPress locally on Ubuntu 20.04 (Start to Finish under 10 min)

In this walk-through we will install all the components needed to run WordPress on your own local or cloud Ubuntu 20.04 server. This video was done as a response to a direct request.

Installation of ubuntu server Raspberry Pi

WordPress based POS solution

The Base Install to run WordPress

ssh to the linux server you have provisioned. We used Ubuntu 20.04 for this walk-through.

We will install Apache, MariaDB, PhP7.4 and WordPress.

ssh root@95.217.222.229

Install Apache Web Server

sudo apt-get update

sudo apt-get install apache2 apache2-utils

sudo systemctl enable apache2

sudo systemctl start apache2

Test apache works by navigating to your servers Ip with a web browser. You should see the below

Image of Apache2 installed and working.

Install MariaDB Database Server

sudo apt-get install mariadb-server mariadb-client

Set the root password for the Database Server

sudo mysql_secure_installation

Enter current password for root (enter for none): (Press Enter)

Enter your new password and confirm

Remove anonymous users? [Y/n] Y

Disallow root login remotely? [Y/n] Y

Remove test database and access to it? [Y/n] Y

Reload privilege tables now? [Y/n] Y

mysql_secure_installation image of output

Install php

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

To test create a file called info.php

sudo vi /var/www/html/info.php

Add the following to the file:

phpinfo text for info.php test

Test php works by navigating to your servers Ip with a web browser. In our case it was http://95.217.222.229/info.php

You should see the below:

info.php page image

Install WordPress

First we need to get the latest WordPress files.

sudo wget -c http://wordpress.org/latest.tar.gz

Extract the files

sudo tar -xzvf latest.tar.gz

Move the WordPress files to /var/www/html

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

Set file / directory permissions

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

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

Create the WordPress user and Database

login to the MariaBD server with the user root and the password you entered earlier.

mysql -u root -p

CREATE DATABASE wp_pos;

GRANT ALL PRIVILEGES ON wp_pos.* TO 'wpposuser'@'localhost' IDENTIFIED BY 'your_DB_password_here';

FLUSH PRIVILEGES;

EXIT;

Update the WordPress config file with Database and user information needed.

Navigate to /var/www/html/

cd /var/www/html/

sudo cp wp-config-sample.php wp-config.php

vi /var/www/html/wp-config.php

Enter the relevant details as seen below:

wp-config settings for walk-through

We now need to rename the default Apache index file so the wordpress one is the active one.

mv index.html index.html.old

Restart apache and Database to ensure the new configs are being use.

sudo systemctl restart apache2.service

sudo systemctl restart mysql.service

Initial WordPress Install

Test WordPress is ready for initial install navigating to your servers Ip with a web browser. you should see the following:

Wordpress Initial Install web page

If you see the page click on “Continue”. You should be presented with the page below. Complete the details and click “Install WordPress”

Creds input for WP install

Once the installation is complete login with the credentials you have just provided.

Wordpress Initial login picture

If your login is successful. You will be presented with the screen shown below. Your WordPress site is now up and running!

WordPress initial login