News
Seven days of Black Friday madness — great deal from Serverspace!
Serverspace Black Friday
BM
November 7, 2022
Updated June 7, 2023

How to install Wordpress and PhpMyAdmin using Docker Compose on Ubuntu 20.04

Docker FAQ Linux Ubuntu VPS

Introduction

Have you ever thought about creating your own website on WordPress? In this post I will show you how to install WordPress and PhpMyAdmin on Ubuntu 20.04 server using Docker Compose.
Docker Compose allows you to work with multi-container Docker applications by acting as its tool.
It requires Docker to be pre-installed, in our case we will use the pre-installed version of Docker.
You can use the instructions or create a server in Serverspace with Docker already installed.

What's required

  • Docker installed on your server, you can install it use to our instructions.
  • Server under Linux Ubuntu 20.04 operating system
  • 4 Gb of RAM or more

Checking the readiness of the system

First of all, let's check if Docker is running on your server using the command.

systemctl status docker

The parameter "active" has to be "running".

2wdp

Update the packages on the server.

1wdp

For future installation, you need to install curl package, you will need it to install Docker Compose.

sudo apt-get install curl -y

Installing Docker Compose

The latest version of Docker Compose is 2.12.2, use the command below to download the repository to your server. You can check the latest version here.

sudo curl -L "https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-$(uname -s)-$(uname -m)" -o /home/docker-compose

3wdp

Note: The repository will be located at /home/docker-compose.

After installation, the downloaded repository needs to be made executable.

4wdp

To check, you can use the ls -la command to check the permissions on the folder.

Copy the repository to the system path.

sudo mv /home/docker-compose /usr/local/bin/

Check the installation by running the command docker-compose, it will give you a list of possible commands.

5wdp

Note: If you get the -bash: /usr/local/bin/docker-compose: No such file or directory error at startup, check that you copied the repository into the system folder. You might get an error -bash: /usr/local/bin/docker-compose: Permission denied, it says that the repository is not executable, give it the rights using the command above.

Installing WordPress and MySQL



Before installing, we have to create the directory and the config for our Docker Compose.

mkdir wordpress

And also create a config.

nano wordpress/docker-compose.yml

6wdp

In this config, we need to specify the image of wordpress, and the image database MySql, which is needed to run WordPress.

12wdp

Note: You can change the port to whatever you want.

Run docker to download and check your config.

8wdp

After launching, it is already possible to go to the web page of our wordpress site, using "https://yourip:8080".

10wdp

Installing PhpMyAdmin

Before installing it, turn off docker compose.

sudo docker-compose down

To install, you will need to go back to our docker config, and enter the image and network parameters.

13wdp

To install and verify that it works, run docker.

sudo docker-compose up

After launching, go to the web page using "https://yourip:8081".

11wdp

The installation is successfully completed.

Conclusion

Docker, allows you to install different packages in just a couple of minutes, thereby saving you time. Thanks to it, you can install any version of a certain package to test your plugins and programs.
Thanks to this publication, you can easily deploy your own site on WordPress, as well as a web interface for the administration of DBMS MySQL - PhpMyAdmin.

Vote:
4 out of 5
Аverage rating : 4.6
Rated by: 11
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.