Install and Configure

Follow these steps to complete the installation and configuration.

  1. Install Docker.
    Docker makes the process of installing and maintaining WordPress, which traditionally requires numerous pieces of software, much easier.
  2. Install MySQL.
    Before installing WordPress, you must install MySQL to store the data.
  3. Install WordPress.
  4. Create a load balancer and install the SSL certificate using OCI Load Balancer.
  5. Update the DNS A record for your domain to the load balancer IP address so it can access the WordPress site hosted in OCI.

Install Docker

SSH into the VM and run the following commands to install Docker:

sudo yum-config-manager --enable ol8_addons
sudo dnf install -y dnf-utils zip unzip
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf install -y docker-ce --nobest
sudo systemctl start docker
Proceed to the next topic and install MySQL.

Install MySQL

Run the following command to install and run MySQL:

sudo docker pull container-registry.oracle.com/mysql/community-server:8.0.33-aarch64
sudo docker run -e MYSQL_ROOT_PASSWORD=<password> -e MYSQL_USER=wp -e MYSQL_PASSWORD=<password> -e MYSQL_DATABASE=wordpress --name wordpressdb --restart on-failure -v
      "$PWD/database":/var/lib/mysql -d container-registry.oracle.com/mysql/community-server:8.0.33-aarch64

Note:

  • MYSQL_ROOT_PASSWORD - Enter the database password.
  • MYSQL_DATABASE - Enter the database name as wordpress.
  • MYSQL_USER - Enter the MySQL username.
  • MYSQL_PASSWORD - Enter the MySQL password.

Proceed to the next topic and install WordPress.

Install WordPress

To install WordPress, follow this procedure:

  1. Run the following command to pull the latest version of the WordPress Docker image:
    sudo docker pull wordpress
  2. Run the following commands to install WordPress:
    sudo docker run -e WORDPRESS_DB_USER=wp -e WORDPRESS_DB_PASSWORD=<password> --name wordpress --link wordpressdb:mysql -p 80:80 -v
          "$PWD/html":/var/www/html -d wordpress

    Note:

    • WORDPRESS_DB_USER - Enter the database user name. Use the same username used when you installed MySQL.
    • -e WORDPRESS_DB_PASSWORD= – Enter the database password. Use the same password used when you installed MySQL.
    • –name wordpress – Gives the container a name.
    • –link wordpressdb:mysql – MySQL container name.
    • -p 80:80 – Tells Docker to publish a container's port to the host.
    • -v “$PWD/html”:/var/www/html – [host-src:]container-dest: Bind mount a volume.
    • -d – Makes the container run in the background.
    • wordpress – Tells Docker to install WordPress from the image pulled in Step 1.
  3. Run the public IP of the compute instance in the browser and complete the WordPress installation.
Proceed to the next topic and create a load balancer for installing the SSL certificate.

Create a load balancer and install the SSL certificate

You must create a load balancer and install the SSL certificate using this load balancer.

  1. Sign in to Oracle Cloud Infrastructure console with your Oracle Cloud credentials.
  2. In the left navigation pane, click Networking, then click Load Balancers, and then click Create Load Balancer.
  3. Select the Load Balancer option, and then click Create Load Balancer.
  4. Enter the Load Balancer Name.
  5. In the Choose Networking area, select the Virtual Cloud Network and Subnet, and then click Next.
  6. Click Add Backends, select the WordPress compute instance, and click Next.
  7. Enter the Listener Name.
  8. Complete these fields to handle HTTPS traffic:
    1. Select HTTPS as the listener type.
    2. Select 443 as the port your listener monitors for ingress traffic.
    3. In the SSL Certificate area, select Load Balancer Managed Certificate from the Certificate Resource drop-down list.
    4. Upload the SSL Certificate for your domain from the Certificate Authority.
    5. Select the Specify Private Key check box and upload the private key.
  9. Click Next.
  10. Select the required logging options.
  11. Click Save.
Copy the load balancer IP address and proceed to the next topic to update the DNS A record for your domain to the load balancer IP address so it can access the WordPress site hosted in OCI.

Update the DNS A record for your domain

You must update the DNS A record for your domain to the load balancer IP address so it can access the WordPress site hosted in OCI.

Note:

Use these steps as a reference as these steps might differ based on your domain hosting provider.
  1. Go to the DNS Management page for your hosted domain.
  2. On the DNS Records page:
    1. Select the Type as A.
    2. Enter a Name.
    3. In the Value field, enter or paste the OCI load balancer IP address.
  3. Click Save.
The domain should now redirect you to the WordPress site hosted on Oracle Cloud Free Tier.