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 fill in a hostname for your Droplet. 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 call 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 begin, 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 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://ghost.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
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, we'll receive output about the setup steps:
Output✔ Creating nginx config file at /var/www/ghost/system/files/ghost.digitalocean.love.conf Running sudo command: ln -sf /var/www/ghost/system/files/ghost.digitalocean.love.conf /etc/nginx/sites-available/ghost.digitalocean.love.conf Running sudo command: ln -sf /etc/nginx/sites-available/ghost.digitalocean.love.conf /etc/nginx/sites-enabled/ghost.digitalocean.love.conf Running sudo command: service nginx restart ✔ 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 default 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)email@example.com
The script will provide feedback as our site is secured. It's normal for the certificate to take a couple of minutes for the certificate 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 more system questions. These settings are already configured, so we'll enter
n for each one:
OutputDo you wish to set up "ghost" mysql user? No ℹ Setting up "ghost" mysql user [skipped] ? 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 ? Do you want to start Ghost? No
Ghost is already running and we said
No to starting it because we'd receive an error. We do need to restart it, though, so we'll use the following command:
- systemctl restart ghost
Step 6 — Creating the Administrative Account
At this point, we've completed our command line work, and we're ready to set up an administrative account, secured with SSL, in a web browser. 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 give
sudo privileges to your user, lock down root login, and take other steps to make your VPS ready for production.
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 usage documentation for more information, or head over to the Ghost Guide. 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