One of the things we have to do after installing Ubuntu 16.04, and more if we come from a clean installation, is reinstall all those programs that we use in our Ubuntu. If you are a web developer you will probably be interested in installing WordPress on your PC. That’s why at Ubunlog we want to teach you how to install WordPress on Ubuntu very easily by following just three steps, Through a tool called docker. We tell you.
Table of Contents
What is Docker?
First and foremost, you need to explain what it is and how it works docker. Well, Docker is a free application that allows us packaging our software projects in what we know as container (containers in English). That way, we can have one Complete File System that contains everything you need (Source code, necessary libraries, system tools …) to be able to run this application on any machine that supports Docker, as if it were a portable application.
Installing Docker and WordPress
Docker has a tool called docker Compose which precisely serves us to be able to manage the containers of a project, so we can start, stop, delete or see their status. To install we only need to run the following command on the terminal:
sudo apt-get install docker-compose
Using Docker to install WordPress
Now that we know what Docker is and have it installed, we can proceed to use it to install WordPress.
- The first step is create a directory called, for example, wordpress (I know, it’s very original) in the root directory using the following command:
mkdir ~ / wordpress
- Then within this directory, we have to create a file called docker-compose.yml, Which we can do by going to the created directory and then creating the desired file, that is, running:
cd wordpress
touch docker-compose.yml
- the file docker-compose.yml must have the following content:
wordpress:
image: wordpress
links:
– wordpress_db: mysql
ports:
– 8080: 80
volumes:
– ~ / wordpress / wp_html: / var / www / html
wordpress_db:
image: MariaDB
environment:
MYSQL_ROOT_PASSWORD: examplepass
phpmyadmin:
image: corbinu / docker-phpmyadmin
links:
– wordpress_db: mysql
ports:
– 8181: 80
environment:
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: examplepass
NOTE: You can manually copy and paste the contents of the file or, alternatively, copy by running:
find file_content> docker-compose.yml
- The last step is to start Docker, which we can easily do by running:
its docker-compose start
Now all you have to do is open your browser (Firefox, Chromium or Chrome) and go to localhost: 8080 through the top text box. And that’s it! Easy truth?
As a final summary, we want to remind you of what we have done. First of all, we have Docker installed, A tool that helps us to package a software project in containers so we can easily take it to any system. Then we have created an archive docker-compose.yml with the WordPress settings requiredFinally, start Docker. We hope this post has helped you install WordPress on your Ubuntu and that if you have any questions, leave it to us in the comments section. Until the next 😉