How To Set Up the DigitalOcean Ghost One-Click Application for Ubuntu 16.04
Ghost is a light-weight open-source blogging platform. It's fully customizable and has many themes available.
Using DigitalOcean's one-click Ghost application, you can create a Droplet with Ghost pre-installed. There's a little bit of command line work to finalize the installation, and then you're on your way to using a simple yet powerful secure blogging tool that lets you manage writing on a day-to-day basis from its web interface. If you'd like to get set up exclusively from a web browser, you might prefer to start with an account hosted by Ghost.
To follow along with all the steps in this tutorial, you will need:
- A Registered Domain Name, configured to use DigitalOcean DNS. If you aren't using DigitalOcean DNS, How To Set Up a Host Name with DigitalOcean can guide you.
When you've set up your domain name on DigitalOcean, you're ready to begin.
Step 1 — Creating a Ghost Droplet
Start on the Droplet creation page. In the Choose an image section, click the One-click apps tab and select the Ghost on 16.04 image.
Next, select the size, region, and any additional settings (like private networking, IPv6 support, or backups). Add any SSH keys and customize a hostname for your Droplet if you wish. When you're ready, click Create Droplet to spin up the server.
Once your Droplet has been created, visit
http://your_server_ip in a web browser. You'll see a placeholder page like the one below, which says Please log into your droplet via SSH to configure your Ghost installation.
This security measure has been put in place to protect Ghost's initial configuration, where anyone who visits the site can create an administrative user.
Step 2 — Setting up your Domain Name
Once you know your Ghost Droplet's IP address, you'll need to add an A name record for your blog. To do so, use the Networking link in the main navigation, locate the domain name you wish to use from the Domains list. You'll arrive on the A name record creation page.
We plan to host our new blog at
https://blog.digitalocean.love so for the Hostname we'll enter
blog. The domain name is automatically appended. Then we'll select our new Ghost Droplet from the list in the Will Direct To list. Finally, we will keep the default value for TTL (Seconds) and click Create Record:
Now that we've made a connection between our domain name and our Droplet, we're ready to proceed.
Step 3 — Logging in to the Droplet with SSH
Once your Droplet has been created, you can access it by connecting to it as root via SSH. This will enable the Ghost installation on your Droplet.
Note: If you haven't used SSH or PuTTY before, you can read How To Connect To Your Droplet with SSH to learn how.
Open a terminal on your computer and log into your Droplet as root via SSH. Make sure to substitute the IP address of your Droplet.
If you are prompted for a password, enter the password that was emailed to you when the Droplet was created and follow the on-screen prompts to replace your temporary password. If you set up the Droplet with SSH keys, the keys will be used for authentication instead.
Before we begin to work in the web browser, we're going to get the latest version and secure the site with SSL from our terminal.
Step 4 — Getting the Latest Version of Ghost
The Ghost project moves quickly, adding new features and keeping the software secure. In this step, we'll make sure we have the latest version.
To manage Ghost, we need to be the
ghost-mgr user, so we'll switch to it with the following command:
- sudo -i -u ghost-mgr
Next, we'll change to the directory where Ghost is installed:
- cd /var/www/ghost
Once here, we'll run its update command:
- ghost update
If an update is needed we'll receive output similar to the following:
Output✔ Checking for latest Ghost version ✔ Downloading and updating Ghost to v1.9.0 Running sudo command: systemctl stop ghost_203-0-113-0 ✔ Stopping Ghost ✔ Linking latest Ghost and recording versions Running sudo command: -E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current [2017-09-25 20:47:36] INFO Finished database migration! ✔ Running database migrations ✔ Validating config Running sudo command: systemctl stop ghost_203-0-113-0 ✔ Restarting Ghost ℹ Removing old Ghost versions [skipped]
If Ghost is up to date, we'll get confirmation instead:
Output✔ Checking system Node.js version ✔ Checking current folder permissions ✔ Checking folder permissions ✔ Checking file permissions ✔ Checking content folder ownership ✔ Checking for available migrations ✔ Checking for latest Ghost version All up to date!
In either case, when the script is complete, we're returned to the command prompt.
Step 5 — Configuring Ghost
Next, we want to be sure that our usernames and passwords are encrypted when we log into the site, so we're going to run Ghost's setup script. Some of the output is fairly technical, so we'll walk through the script in steps and guide you through the choices you'll need to make.
We'll start by issuing the
setup command from within the
- ghost setup
We'll enter the URL of our blog in response to the first question. Be sure to enter your domain name instead:
Output? Enter your blog URL: http://blog.digitalocean.love
Afterward, we'll be asked several questions about MySQL and the database. These settings have already been configured on our Droplet, so we can accept the values given:
Output? Enter your MySQL hostname: localhost ? Enter your MySQL username: ghost ? Enter your MySQL password (skip to keep current password): [hidden] ? Enter your Ghost database name: ghost_production ✔ Configuring Ghost ✔ Setting up instance Running sudo command: chown -R ghost:ghost /var/www/ghost/content ✔ Setting up "ghost" system user
When the script asks about setting up a mysql user, one has already been set up, so we'll enter
ghost setup continuedDo you wish to set up "ghost" mysql user? n
Next, in order to make our site production-ready, when we're prompted to set up Nginx, we'll accept the default,
ghost setup continued? Do you wish to set up Nginx? (Y/n)Y
Once we've said yes, the script will set up configuration files:
Output✔ Creating nginx config file at /var/www/ghost/system/files/blog.digitalocean.love.conf Running sudo command: ln -sf /var/www/ghost/system/files/blog.digitalocean.love.conf /etc/nginx/sites-available/blog.digitalocean.love.conf Running sudo command: ln -sf /etc/nginx/sites-available/blog.digitalocean.love.conf /etc/nginx/sites-enabled/blog.digitalocean.love.conf Running sudo command: nginx -s reload ✔ Setting up Nginx
The next choice we'll need to make is whether to set up SSL with Let's Encrypt. You can learn more about Let's Encrypt in the Introduction to Let's Encrypt Guide.
Again, this defaults to "Yes". We can press
ENTER or type
Y to proceed. After that, we'll provide an email address to receive information about our security certificate.
Output? Do you wish to set up SSL? Y ? Enter your email (used for Let's Encrypt notifications)firstname.lastname@example.org
The script will provide feedback as our site is secured. It's normal for the certificate to take a couple of minutes to be generated.
Output✔ Creating ssl security parameters file at /var/www/ghost/system/files/ssl-params.conf ✔ Creating ssl config file at /var/www/ghost/system/files/ghost.digitalocean.love-ssl.conf Running sudo command: ln -sf /var/www/ghost/system/files/ghost.digitalocean.love-ssl.conf /etc/nginx/sites-available/ghost.digitalocean.love-ssl.conf Running sudo command: ln -sf /etc/nginx/sites-available/ghost.digitalocean.love-ssl.conf /etc/nginx/sites-enabled/ghost.digitalocean.love-ssl.conf Running sudo command: service nginx restart ✔ Setting up SSL
Once SSL is set up, we'll be asked if we wish to set up Systemd. This is already configured, so we'll say
Output? Do you wish to set up Systemd? No ℹ Setting up Systemd [skipped] Running sudo command: -E -u ghost /usr/lib/node_modules/ghost-cli/node_modules/.bin/knex-migrator-migrate --init --mgpath /var/www/ghost/current [2017-09-25 21:11:48] INFO Finished database migration! ✔ Running database migrations
Ghost is already running so we'll say
No to starting it because we'd receive an error.
Output? Do you want to start Ghost? No
We do need to restart it, though, so we'll use the following command:
- sudo systemctl restart ghost\*
At this point, we've completed our command line work, and we'll switch to a web browser.
Step 6 — Creating the Administrative Account
In a web browser, we'll visit the site to secure the site's administrative account. Regardless of whether the URL we enter begins with
https:// we'll be redirected to
To reach the set up dialog, visit the
/ghost page by entering
https://your_server_domain/ghost in a web browser:
From here, you can follow Ghost's workflow to set up an administrative account, after which you will have a fully working Ghost blog. You're ready to start working with Ghost. In addition, we recommend you follow our Initial Server Setup guide to create a
sudo user, lock down root login, and take other steps to make your Droplet ready for production.
Note: Whether you manage the Droplet itself as root or with a sudo user as recommended in the Initial Server Setup guide, you will always need to become the
ghost-mgr to manage your Ghost installation:
- sudo -i -u ghost-mgr
DigitalOcean's Ghost one-click application makes helps you get started blogging with Ghost, and your Droplet is set up to make it as easy as possible to look after your blog in the long term.
There are a lot of other options for customization with Ghost. Check out the Ghost documentation for more information. Remember that under certain conditions, like when you install a theme or upgrade, you may need to stop, start, or restart Ghost. You can manage the Ghost service like other Systemd services, using