Book Image

Ubuntu Server Cookbook

By : Uday Sawant
Book Image

Ubuntu Server Cookbook

By: Uday Sawant

Overview of this book

Ubuntu is one of the most secure operating systems and defines the highest level of security as compared other operating system. Ubuntu server is a popular Linux distribution and the first choice when deploying a Linux server. It can be used with a $35 Raspberry Pi to top-notch, thousand-dollar-per-month cloud hardware. Built with lists that there are 4 million + websites built using Ubuntu. With its easy-to-use package management tools and availability of well-known packages, we can quickly set up our own services such as web servers and database servers using Ubuntu. This book will help you develop the skills required to set up high performance and secure services with open source tools. Starting from user management and an in-depth look at networking, we then move on to cover the installation and management of web servers and database servers, as well as load balancing various services. You will quickly learn to set up your own cloud and minimize costs and efforts with application containers. Next, you will get to grips with setting up a secure real-time communication system. Finally, we’ll explore source code hosting and various collaboration tools. By the end of this book, you will be able to make the most of Ubuntu’s advanced functionalities.
Table of Contents (20 chapters)
Ubuntu Server Cookbook
Credits
About the Author
www.PacktPub.com
Preface
Index

Deploying WordPress using a Docker network


In this recipe, we will learn to use a Docker network to set up a WordPress server. We will create two containers, one for MySQL and the other for WordPress. Additionally, we will set up a private network for both MySQL and WordPress.

How to do it…

Let's start by creating a separate network for WordPress and the MySQL containers:

  1. A new network can be created with the following command:

    $ docker network create wpnet
    
  2. Check whether the network has been created successfully with docker network ls:

    $ docker network ls
    
  3. You can get details of the new network with the docker network inspect command:

    $ docker network inspect wpnet
    
  4. Next, start a new MySQL container and set it to use wpnet:

    $ docker run --name mysql -d \
    -e MYSQL_ROOT_PASSWORD=password \
    --net wpnet mysql
    
  5. Now, create a container for WordPress. Make sure the WORDPRESS_DB_HOST argument matches the name given to the MySQL container:

    $ docker run --name wordpress -d -p 80:80 \
    --net wpnet\
    -e WORDPRESS_DB_HOST...