WordPress Migration to OCI: Installing MariaDB and NGINX for WordPress

I will cover how to migrate the data first as it is the essential component to get WordPress site going. In my previous blog post, I covered how to backup data, so please refer to it to back up the existing WordPress data.

Install MariaDB

MariaDB is a forked database engine from MySQL. As far as I remember, it has 100% compatibility with MySQL and it’s completely free.

SSH into the host you provisioned.

$ ssh opc@[IP address for the host]

Install MariaDB on the host.

$ sudo yum install mariadb-server

Start the database server.

$ sudo systemctl start mariadb

Make sure that the service starts on OS start up.

$ sudo systemctl enable mariadb

Start the initial configuration process.

$ sudo mysql_secure_installation

The command above will ask the following questions.

  • Enter current password for root (enter for none): -> Simply hit enter here.
  • Set root password? [Y/n] –> Y
  • New password: –> New password for root credential of MariaDB.
  • Re-enter new password: –> Repeat.
  • Remove anonymous users? [Y/n] –>Y
  • Disallow root login remotely? [Y/n] –> Y or n depending on your need but Y is securer.
  • Remove test database and access to it? [Y/n] –> Y
  • Reload privilege tables now? [Y/n] –>Y

Your MariaDB is now more secured and ready for you to use.

Install NGINX (web server)

I am choosing NGINX for web server to serve the WordPress pages. Follow the steps below to install and configure NGINX.

First, create nginx.repo file under /etc/yum.repo.d/

$ sudo vi /etc/yum.repo.d/nginx.repo

Paste the following text.

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

Save the file and exit.

:wq

Back in the command line, install the latest NGINX.

$ sudo yum -y install nginx

Start NGINX.

$ sudo systemctl start nginx

Make sure NGIX survives the restart.

$ sudo systemctl enable nginx

Make sure the host can accept incoming traffic to HTTP and HTTPS.

$ sudo firewall-cmd --add-service=http --permanent --zone=public
$ sudo firewall-cmd --add-service=https --permanent --zone=public
sudo firewall-cmd --reload

If you browse to http://[Your public IP address], you will see welcome screen from NGINX.

Recap

I am planning to cover how to restore data in MariaDB and configure it in the next blog. More to come!

Author: admin

A software engineer in greater Seattle area

Leave a Reply

Your email address will not be published. Required fields are marked *