This entry is part 1 of 2 in the series How To Install WordPress

Sometimes you are stuck with an older OS. You can still get the most out of your server. Here we outline how to get a fully functional WordPress installation running on Ubuntu 16.04.

First, we start with the basics – get your Ubuntu updated.

sudo apt-get update
sudo apt-get upgrade

Notes about using VI/VIM

VI/VIM can be frustrating at times, but once you get the hang of it, its pretty awesome. In this guide we will be using it exclusively. Here’s a few tips

ESC is your friend.  Use it if you’ve accidentally hit a button and something isn’t letting you work on it properly.

:wq! To write and quit the file with no further prompts

:q! To quit without changes:w To write changes, but don’t quit.

Install PHP 7.3

We want to make sure we are using a newer version of PHP than comes with Ubuntu 16.04, so lets start with adding a new repository, updating the apt cache, and finally installing PHP 7.3

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.3

Install Apache

sudo apt-get install apache2

You will get an annoying warning in apache if you don’t have this line, so let’s edit the apache2.conf.

sudo vi /etc/apache2/apache2.conf

Now lets add the below line at the bottom

ServerName example.com

Now test the config and restart apache.

sudo apache2ctl configtest
sudo systemctl restart apache2

Install MySQL Server

Run the following to install MySQL Server. Make sure you use a secure password.

sudo apt-get install mysql-server

Let’s secure mysql, shall we?

mysql_secure_installation

You’ll get these choices

Securing the MySQL server deployment.

Enter password for user root:

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.

Estimated strength of the password: 50
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password:

Re-enter new password:

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

Add a few additional php modules, we’ll need them for WordPress

sudo apt-get install php-pear php7.3-curl php7.3-dev php7.3-gd php7.3-mbstring php7.3-zip php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-soap php7.3-intl php7.3-imagick

Since we will be using this site for WordPress, lets make apache prefer PHP files

sudo vi /etc/apache2/mods-enabled/dir.conf

Make index.php the first position after DirectoryIndex

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

Restart and check apache status

sudo systemctl restart apache2
sudo systemctl status apache2

Intended result

At the end of this, you should have a running site (without any content) on a URL of your choosing.

Series NavigationCreate a WordPress Site >>