Setting Up an Ubuntu Server For WordPress (LAMP)

Getting Ready

Update your package list and install upgrades:

1
sudo apt update && sudo apt upgrade

Install Apache

1
sudo apt install apache2

Install MYSQL Server

1
sudo apt install mysql-server

Configure MYSQL Server

Login to the MYSQL shell with:

1
sudo mysql -u root

Create a new database for WordPress:

1
2
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO 'wordpress' IDENTIFIED BY 'password';

Make sure to set your password to something secure!

Exit the shell:

1
quit

Run the MYSQL Secure Installation:

1
sudo mysql_secure_installation

Make sure to read each option carefully, but generally speaking you can answer yes to all in most cases.

Install PHP

1
sudo apt install php7.2 libapache2-mod-php7.2 php-mysql

Also install some extra packages that might be needed by WordPress:

1
sudo apt install php-curl php-json php-cgi

Allow Your Server Through The Firewall

1
sudo ufw allow in "Apache Full"

Restart Apache

1
sudo service apache2 restart