Kristófer Reykjalín

Managing your site with WordOps

Published on March 20, 2021.

WordOps is a wonderful tool, specifically made to make hosting WordPress websites easier, although they also provide excellent support for setting up and managing static sites, reverse proxies, and the like. It’s a wonderful tool for managing websites, and I highly recommend you use it.

I want to to take you through the steps necessary to install and configure WordOps, and launching your first WordPress site!

Before you get started

Make sure you have the following available before you start:

  1. A server.
  2. A domain that points to the server; I'll be using thorlaksson.com as the example domain in this post.

I’ll be using an Ubuntu 20.04 server with an expandable volume attached where I will host sites, which will require some additional setup.

Tip!

WordOps also supports Debian and Raspbian, if you prefer either of those over Ubuntu.

Mounting the volume for expandable storage

Note!

You can skip this section entirely if you don’t need to mount a volume and jump straight to the WordOps installation.

I’m using Hetzner to host the server, so these instructions will be specific to servers hosted with them. The process should be similar for any other service, but there might be a few differences.

First, delete your /var/www/ directory. If you already have things there you want to keep, make sure you back them up.

cp -r /var/www ~/ # For backup purposes
sudo rm -rf /var/www

Open your fstab file with your favorite editor and mount your volume there.

sudo nano /etc/fstab # to open the file with nano
sudo vi /etc/fstab # to open the file with vi

Add the following line to your fstab, and make sure to change the volume ID.

/dev/disk/by-id/<volume_id> /var/www ext4 discard,nofail,defaults 0 0

Your fstab should now look something like this.

# /etc/fstab: static file system information.
UUID=2B0E-1DC7  /boot/efi       vfat    umask=0077      0       1
/dev/disk/by-id/scsi-0HC_Volume_10143990 /var/www ext4 discard,nofail,defaults 0 0

Now, reboot your server, and ssh back into it.

sudo reboot

Once your server is up again, make sure the /var/www/ directory has the correct ownership setup.

sudo chown -R www-data:www-data /var/www

And now we’re ready to setup WordOps!

Installing WordOps

To install WordOps use ssh to connect to your server and run the installation command.

wget -qO wo wops.cc && sudo bash wo

This will install WordOps and its dependencies on your system.

Tip!

Many people are uncomfortable with piping scripts to sudo for a good reason. If you prefer you can clone the repository from git and install it that way:

git clone https://github.com/WordOps/WordOps.git
cd WordOps/
sudo bash install

WordOps also provides a set of fully manual installation steps if you prefer to really do everything yourself.

WordOps requires super user privileges to manage everything for you, so it’s a good idea to add a command alias to automatically run the wo command with super user privileges.

echo -e "alias wo='sudo -E wo'" >> $HOME/.bashrc

Now that the wo tool has been installed, we use WordOps to install the technology stack used to run the websites. You can see precisely what will be installed here.

wo stack install

During this installation WordOps will create credentials for the administrative dashboard, but we’ll change those with the next command.

wo secure --auth

You’ll be prompted for a username and password. Generate a strong password with you password manager and save it there.

Remember to enable the firewall too!

wo stack install --ufw

Now, you should be able to look at the admin dashboard at https://<domain>:22222. In my case, that’s https://thorlaksson.com:22222.

The SSL certificate won’t be valid for the admin dashboard, but don’t worry about that; that will be fixed when we create our first site.

Creating your first WordPress site

Now it’s time to setup a WordPress site! 🎉

Run the site create command with a couple extra flags.

wo site create thorlaksson.com --wp --php74 --user=<wp_admin_username> --email=<admin_email> -le

Once that command has wrapped up you should have a WordPress site ready to go, with the username and password to login printed out during the installation.

Tip!

I created a simple WordPress site here with no caching set up. You can change that by replacing the --wp flag with any of the other WordPress flags to set up caching with WP Rocket, Redis, or any of the other caching solutions supported.

I recommend you change the admin password immediately when you first login to the WordPress site. Use your password manager to generate something stronger than the password generated by default.

Before we login though, let’s install some essential plugins, with WP CLI — a tool WordOps installed for us! Just make sure to run these commands with sudo or as www-data.

wo site cd thorlaksson.com
cd htdocs
# You should now be in /var/www/<domain>/htdocs

# Now let's install some plugins
wp plugin install akismet --allow-root --activate # To prevent comment spam
wp plugin install gutenberg --allow-root --activate # To use the latest version of Gutenberg
wp plugin install two-factor --allow-root --activate # So we can use 2fa for website accounts
wp plugin install wordpress-seo --allow-root --activate # For SEO

# Fix permissions
sudo chown www-data:www-data wp-content -R

You can use commands like this to automate the setup of new sites. If you manage multiple sites, or setup new sites on a regular basis, having a script to set everything up for you is an amazing boon.

Of course, you can remove or add plugins here as you like, or simply do this all through the WordPress dashboard.

Finally, let’s make sure everything on the server is up to date. You can run this same command whenever you want to install updates on your server.

wo maintenance

And that’s it! Your WordPress site is now ready at https://<domain>!

Conclusion

WordOps is an extremely versatile tool for website hosting, especially if you’re managing a WordPress site, or even multiple WordPress sites. I personally use this to great effect to set up testing sites at work.

WordOps is also useful for just managing your web server’s reverse proxies or static sites. I didn’t talk about this much here, but refer to the documentation for how to set those up.

Being able to spin up a site quickly without having to worry about managing a web server, keeping dependencies up to date, setting up a database, and securing everything saves so much time.

Finally, you can just focus on managing a website instead of managing a server.