Install WordPress with Docker on Ubuntu 20.04 for free

This article will guide you on how to install the latest WordPress build on Ubuntu 20.04 for free. It is a simpler process and requires less time to complete.

There are many benefits of installing WordPress with Docker on Ubuntu 20.04 for free that can be leveraged by both small and large companies-

* You can use the latest version of WordPress instead of an older version which is available in most distributions

* It is a simpler process and requires less time to complete * You need not worry about any security issues like vulnerabilities or outdated packages because all the packages are up-to-date * Containerizing application makes it easier to scale than traditional hosting.

Prerequisites

  • A fresh Ubuntu 20.04 VPS on the Oracle Cloud Platform
  • A root password configured on your server

Step 1 – Create Oracle Cloud Server

First, log in to your Oracle Cloud Always free account Create a new server, choosing Ubuntu 20.04 as the operating system with at least 1GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Also read: How To Create Always FREE VPS in Oracle Cloud

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Docker

By default, the latest version of Docker is not available in the Ubuntu 20.04 default repository, so it is a good idea to add the Docker official repository to your system.

First, download and add the GPG key with the following command:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -

Next, add the Docker repository with the following command:

add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Once the repository is added, you can install the Docker and Docker Compose using the following command:

apt-get install docker-ce docker-ce-cli containerd.io  -y

After installing both packages, check the installed version of Docker with the following command:

docker --version

You should get the following output:

Docker version 19.03.12, build XXXXX00XX

Step 3 – Create a WordPress Container

First, download the WordPress image from the Docker repository using the following command:

docker pull wordpress:latest

Step 4 – Configure Nginx as a Reverse Proxy

Next, you will need to install and configure Nginx as a reverse proxy for the WordPress container so you can access your WordPress using port 80.

First, install the Nginx web server with the following command:

apt-get install nginx -y

Once installed, create a new Nginx virtual host configuration file:

nano /etc/nginx/sites-available/wordpress

Add the following lines:

server {
  listen 80;
  server_name wp.example.com;
  location / {
    proxy_pass http://localhost:8081;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

Save and close the file, then activate the virtual host with the following command:

ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/

Next, restart the Nginx service to apply the changes:

systemctl restart nginx

Step 5 – Access WordPress Interface

Now, open your web browser and type the URL http://example.com. You will be redirected to the WordPress installation wizard:

*****

Conclusion

In this guide, you learned how to install WordPress with Docker on Ubuntu 20.04.

The installation of the Docker engine varies depending on the specific Linux distribution you are using, as well as your admin privileges and the location you want to install it in.

Leave a Comment