Step-by-Step Guide: Installing WordPress on DigitalOcean using Sail

Share this article

Introducing Sail: A Beginner’s Guide to Managed WordPress Hosting

Sail: An Affordable Alternative to Traditional WordPress Hosting

Sail is a free and open source CLI tool that allows you to provision and manage WordPress applications in the DigitalOcean cloud. It offers a more affordable and flexible solution compared to traditional managed WordPress hosting.

Sail Logo

The Limitations of 1-Click WordPress Installer

While the 1-click WordPress installer provided by DigitalOcean is suitable for many users, it has limited functionality for power-users and developers. This is where Sail CLI comes in.

What is Sail CLI?

Sail CLI is a complete set of tools that allows you to provision and manage a production-grade WordPress environment in just a few minutes, directly from the Terminal. It fills the gap left by the 1-click installer and provides more control over your WordPress application.


Before getting started with Sail CLI, you will need:

  • A DigitalOcean account with a read-write API access token
  • Python 3.6+, rsync, and ssh installed on your system (already available on macOS and Linux)
  • A fully-qualified domain name (optional, Sail can generate a free subdomain for you)
  • Prior experience with CLI-based tools like WP-CLI, git, composer, and npm

Step 1: Installing Sail CLI

To install Sail CLI, open your Terminal and run the following command:

curl -sSLf | bash

This command will download and install the latest version of Sail on your system. You can use the same installer to upgrade or downgrade Sail if necessary.

Once installed, you can check the version by running:

sail --version

Step 2: Configuring Your API Token

In order to use Sail with DigitalOcean, you need to configure your API token. Run the following commands to set up your token and admin email:

sail config provider-token <token>
sail config email <your-email>

Step 3: Creating Your First Sail Project

Now it’s time to create your first Sail project. First, create a new empty directory for your project. Then, navigate to that directory and run:

sail init

This command will create a new server on your DigitalOcean account and install all the necessary software and services for your WordPress site. It will also generate a subdomain, obtain an SSL certificate, and download the latest version of WordPress.

After the command completes, you will be provided with the URL and access credentials for your new WordPress site. You can now log in, install themes and plugins, and add content to your site.

Step 4: Adding Domains and SSL Certificates

If you want to use a custom domain for your site, you can add it using the following command:

sail domain add

This will create a domain entry on your DigitalOcean account and add the necessary DNS records to point the domain to your WordPress site. You can also request an SSL certificate using:

sail domain make-https

This will install an SSL certificate from Let’s Encrypt, which will be automatically renewed as long as the domain remains pointed at your server.

Step 5: Creating and Restoring Backups

Backups are crucial for any production website. Sail provides commands to help you create and restore backups. To create a full site backup, run:

sail backup

This will download all your application files, media, and a database snapshot to your local working copy and store it in the .backups folder of your Sail project directory.

To restore a backup, use the following command:

sail backup restore path/to/backup.tar.gz

You can also export or import the database separately using the commands sail db export and sail db import.

Step 6: Adding More Sites

Sail allows you to host multiple sites on a single DigitalOcean server. To create a new application on an existing server, use a namespace. For example:

mkdir ~/projects/
cd ~/projects/
sail init --namespace=secondary --environment=~/projects/

This command will create a new application under the secondary namespace on the same server where is provisioned.

Step 7: Deploying with Sail

In order to maintain a local development copy of your website and deploy changes to your production site, you can follow the deployment workflow. This involves maintaining a working copy of your application files on your local computer, which can be updated manually or through version control systems like Git.


Please enter your comment!
Please enter your name here

Recent comments