How Set Up An Awesome WordPress Blog on Ubuntu 22.04

If you’re wanting to set up your own blog on Ubuntu, then this is the video for you! In this complete walkthrough, you’ll set up your very own WordPress installation on an Ubuntu cloud instance. This walkthrough will go over launching an instance, setting up a MariaDB database, installing PHP plugins, and by the end of the video you’ll set up a certificate with Let’s Encrypt for a secure connection to your blog. This is a fun project, so definitely check it out!

YouTube player

Thanks to Percona for sponsoring today’s video! Check out the links below to see how they can help you retain support on MySQL 5.7 after its end of life, upgrade to MySQL 8.0, and more!

Commands used in this video

Below is a list of commands that were used in the video, if you’d like to copy and paste during setup.

Adding a non-root user for yourself

adduser jay
usermod -aG sudo jay
exit

Now that you have a user set up for yourself, be sure to log out and log in as that user before continuing.

Updating the hostname

Edit the following files in order to add your hostname or domain name to your instance.

sudo nano /etc/hostname
sudo nano /etc/hosts

Install updates

Before continuing, we should make sure we have everything up to date to benefit from all current security patches for Ubuntu.

sudo apt update
sudo apt dist-upgrade

Reboot the instance

sudo reboot

Install Apache

sudo apt install apache2
systemctl status apache2

Set up MariaDB

sudo apt install mariadb-server
sudo mariadb
CREATE DATABASE wordpress_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
SHOW DATABASES;
GRANT ALL PRIVILEGES ON wordpress_db.* TO wordpress_user@localhost IDENTIFIED BY 'secret_password';
FLUSH PRIVILEGES;
EXIT;

Download and Extract WordPress

wget https://wordpress.org/latest.zip
sudo apt install unzip
unzip latest.zip
sudo -R chown www-data:www-data wordpress
mv wordpress /var/www

Add a configuration file for WordPress to Apache

sudo nano /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
    DocumentRoot /var/www/wordpress
    <Directory /var/www/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /var/www/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>
sudo a2dissite 000-default.conf
sudo a2ensite wordpress.conf

Install additional required packages

sudo apt install libapache2-mod-php php-curl php-gd php-intl php-mbstring php-mysql php-soap php-xml php-xmlrpc php-zip
sudo a2enmod rewrite
sudo systemctl restart apache2

After all of that, access your site and then fill out form in the web browser. Then, you’re all set!