Linux MySQL

How to Install or Migrate WordPress with EasyEngine Setup

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

How to Install or Migrate WordPress with EasyEngine Setup. EasyEngine is a tool used for complete WordPress setup with Nginx, PHP, MySQL, Redis, HTTPS and many more. You will also get the power for Docker containers using this setup. Each service like Nginx or PHP or MySQL will have their own Docker container.

In this guide you are going to learn how to install EasyEngine on Ubuntu 20.04 and setup WordPress and also migrate existing WordPress to EasyEngine setup.

This setup is tested on Google cloud Compute Engine and DigitalOcean droplet with Ubuntu 20.04 OS.

Prerequisites

  • Root access to your server or a user with sudo privileges.
  • Some basic knowledge to run commands on terminal.

Step 1: Initial Server Setup

Once you have a new server with Ubuntu 20.04, you can SSH to the terminal and update the packages to the latest version.

sudo apt update
sudo apt dist-upgrade

Step 2: Install EasyEngine

Now you an install EasyEngine using the below command. This takes sometime to complete the setup because it installs and configures Docker and Docker Compose.

wget -qO ee rt.cx/ee4 && sudo bash ee

Once the installation is completed you can start the setup.

Step 3: Install WordPress

We can use the site create command to create a setup on your domain name.

The below command is used to configure a WordPress site with Let’sEncrypt SSL, latest PHP, Proxy cache.

If you are using Let’sEncrypt SSL you need to setup your email as global. This is necessary for auto renewal.

sudo ee config set le-mail [email protected]

Let’sEncrypt SSL

sudo ee site create domain.com --type=wp --ssl=le --php=latest --proxy-cache=on --cache

CloudFlare SSL or any Custom SSL

When you use CloudFlare SSL for your site, generate SSL certs for origin server from CloudFlare dashboard and copy the certificate and private key to your server. Note down the path and use in the below command.

sudo ee site create cloudbooklet.com --type=wp --ssl=custom  --ssl-key='/etc/ssl/custom/cloudbooklet.com/privkey.pem' --ssl-crt='/etc/ssl/custom/cloudbooklet.com/cert.pem' --php=latest --proxy-cache=on --cache

This command will generate a random username, password and use random email. If you want to customize to your needs, then you can pass the below arguments.

  • –title=yourtitle: For setting up WordPress title.
  • –admin-email=youremail: For setting up admin email.
  • –admin-user=yourusername: For setting up WordPress username.
  • –admin-pass=yourpassword: For setting up WordPress password.

Once you have execute one of the above commands the setup will start and create docker containers for Nginx, PHP, MySQL, Let’sEncrypt and configure everything with Redis, installing Nginx Cache plugin.

Once the installation is completed you will see the output similar to the one below.

+--------------------+----------------------------------+
| Site               | https://domain.com               |
+--------------------+----------------------------------+
| Site Root          | /opt/easyengine/sites/domain.com |
+--------------------+----------------------------------+
| Site Title         | domain.com                       |
+--------------------+----------------------------------+
| WordPress Username | your-username                    |
+--------------------+----------------------------------+
| WordPress Password | your-password                    |
+--------------------+----------------------------------+
| Alias Domains      | None                             |
+--------------------+----------------------------------+
| DB Host            | global-db                        |
+--------------------+----------------------------------+
| DB Name            | domain_com                       |
+--------------------+----------------------------------+
| DB User            | domain.com-r5g4bs                |
+--------------------+----------------------------------+
| DB Password        | db-password                      |
+--------------------+----------------------------------+
| E-Mail             | [email protected]              |
+--------------------+----------------------------------+
| SSL                | Enabled                          |
+--------------------+----------------------------------+
| SSL Wildcard       | No                               |
+--------------------+----------------------------------+
| Cache              | Enabled                          |
+--------------------+----------------------------------+
| Proxy Cache        | Enabled                          |
+--------------------+----------------------------------+

Now the setup is completed and you can check your site in browser. You can see the fresh WordPress installation.

You can view the above details anytime using the site info command.

ee site info domain.com

Step 4: Install PhpMyAdmin

phpMyAdmin in EasyEngine is available in Admin-Tools. So we need to install admin-tools.

ee admin-tools enable domain.com

Now you will get the HTTP username and password which is an additional layer of security to access phpMyAdmin.

To access phpMyAdmin use the below format with your domain name.

https://domain.com/ee-admin/pma

You will be prompted to enter the HTTP auth credentials first. Use the correct details and then you can login to phpMyAdmin using your website database credentials.

Optional: For Migration

The below steps are needed only if you are migrating an existing WordPress site to the new installation.

Prerequisites

  • Generate backup of your files from old server.
  • Generate backup of your database from old server.

Step 5: Upload Backup Files

Your WordPress files like themes, plugins, media are located inside the Docker container. You cannot upload the files directly to the Docker container. So we need to upload the files to the mount point.

The site root path where your files are located can be found from the site info command. It should be similar to the one below.

/opt/easyengine/sites/domain.com/app/htdocs

Now navigate to this directory and delete all the existing contents.

Now upload your backup files to this directory. Remove the wp-config.php file.

Once uploaded update the database prefix in your wp-config.php file which is located outside of the current directory (/opt/easyengine/sites/domain.com/app) with yours.

Configure permissions

sudo chmod -R 755 /opt/easyengine/sites/domain.com/app/htdocs
sudo chown -R www-data:www-data /opt/easyengine/sites/domain.com/app/htdocs

Step 6: Upload Database Backup

Upload your database to the new server.

First we need to delete the existing tables in your database. Now we need to login to MySQL which is inside the MySQL container.

Use the below command to login to MySQL.

cd /opt/easyengine/services && docker-compose exec global-db bash -c 'mysql -uroot -p${MYSQL_ROOT_PASSWORD}'

Switch to your database.

USE database_name;

Check all tables.

SHOW TABLES;

Delete all tables.

DROP TABLE table_1, table_2, table_3

Replace table_1 with the correct table names.

Import database backup

Navigate to the directory where you have uploaded the database .sql file.

Execute the below command to find the container ID of our database.

docker ps

You will see a list of containers. Note down the container ID of the MariaDB container.

Execute the below command to import the database.

docker exec -i CONTAINER_ID mysql -udomain.com-r5g4bs -pdb-password --database=domain_com < db-backup.sql

Now your backup database will get imported to the database.

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Conclusion

Now you have learned how to install or migrate a WordPress website to EasyEngine setup with Docker and Docker compose.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.