The Wayback Machine - https://web.archive.org/web/20140422165659/http://ghosted.co/install-ghost-digitalocean/

How to Install the Ghost Blogging Platform on a DigitalOcean Droplet in 10 Steps

The Ghost blogging platform finally launched! I'm writing this post on the platform and it's an incredible experience so far.

This guide will show you how to get Ghost up and running in 10 fairly easy steps.

Note: the Ghost software is only available to the 6,000 or so Kickstarter backers. They'll be opening to the wider public in the next couple of weeks.

In this guide I'm using a DigitalOcean VPS droplet because they're cheap ($5 a month), easy to set up and reliable.

Here are 10 steps to install the Ghost platform on a DigitalOcean droplet:

1. Get domain (namecheap)

You'll want to register a domain for this setup. I used NameCheap to register ghosted.co for this project, but feel free to use your own registrar.

This guide assumes you're using NameCheap, so you may need to modify accordingly if you use a different registrar.

2. Sign up for DigitalOcean

DigitalOcean is a revolutionary new web hosting company. They provide cheap, fast, reliable servers starting at just $5 a month. This example will assume you're using a DigitalOcean droplet.

Get a new DigitalOcean account here (I'll get a commission if you signup through that link, but feel free to visit them directly, DigitalOcean is awesome).

Use the promo code "DIVEIN5" for a $5 credit on new accounts at DigitalOcean.

3. Create a DigitalOcean Droplet

Click "Create Droplet" in your DigitalOcean control panel.

Enter your domain name in the "Hostname" field, and select the size you want (I'm currently running this site on the $5/month 512MB droplet size).

Droplet Creation

Select a region (I'm using NY2, you might want to choose a region near you or your main visitors, but it doesn't matter much).

Now select an image. These instructions are for Centos 6.4 x64, which is a common and stable distribution. If you use another image type, your mileage with the rest of this tutorial may vary.

Image Selection

Leave the VirtIO setting enabled and click Create Droplet.

This should take about 60 seconds or less.

Now you have a server running at the IP address on the confirmation page! You should see a page that looks something like this:

Image Confirmation

DigitalOcean also emailed you with root password and login instructions, which we'll use in a minute.

4. Configure DNS (DO and NC)

Now you need to update your Namecheap DNS records to tell Namecheap that DigitalOcean will be serving up the domain.

In your NameCheap account in the Manage Domains section for your new domain, click the Domain Name Server Setup link and enter the following addresses in the "Specify Custom DNS Servers" area:

NS1.DIGITALOCEAN.COM
NS2.DIGITALOCEAN.COM
NS3.DIGITALOCEAN.COM

NameCheap DNS Config

Click Save Changes.

Now you need to add your domain name to DigitalOcean's DNS servers.

Click "DNS" in the DigitalOcean control panel sidebar.

Now click the big "Add Domain" button. Enter your domain name and choose your hostname from the dropdown on the right (your IP address will be automatically filled in when you do).

DNS Config at DigitalOcean

Now click "Create Domain"

5. Install Node.js

Node.js is the new technology Ghost is built on.

According to nodejs.org:

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Now we're going to log into your new DigitalOcean server and install Node.js.

Note: you can also refer to this tutorial from the DigitalOcean website about installing Node on Centos, I borrowed from it for the instructions below.

First, find the email from DigitalOcean with your root password.

Open up a terminal window and type:

ssh root@insert your ip address]

Replace the IP address from DigitalOcean in the ssh command.

Now change your root password and write the new password down somewhere:

passwd

Now update your software repository:

yum -y update

Now install "Development Tools". It's a group of tools for compiling software from sources:

yum -y groupinstall "Development Tools"

(installing Development Tools will take a couple of minutes)

Now install Node. Note, you should look for the latest node source from http://nodejs.org/download/. As of this post, the latest version was 0.10.18 as you see in the instructions.

To install Node.js:

(note in the command below, the http:// needs an extra slash. Ghost auto completes anchor tags so I had to leave the slash out to avoid the html in the code)

cd /usr/src

wget http:/nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz

tar zxf node-v0.10.18.tar.gz

cd node-v0.10.18

./configure

make

You'll need to wait for the make to finish. This took around ~7 minutes on my DigitalOcean droplet.

Now make the compiled code available system-wide:

make install

Node is installed! To verify, you can enter the following command:

node -v

And you should see something like this:

v0.10.18

6. Install Ghost

Now it's time to install Ghost. First create user that Ghost will run under:

useradd ghost
su ghost

We're going to now get the ghost source and install it in a directory called Ghost:

cd 
mkdir ghost
cd ghost

Because Ghost is currently only available to Kickstarter backers (who have logged in to the Ghost.org site), you'll have to log into the site, download the Ghost source, then SFTP the file over to your server.

Download the Ghost zip file to your local machine here:

https://en.ghost.org/download/

Now open up Transmit, Coda or your favorite FTP client. Connect via SFTP, logging in using your SSH credentials with your new password.

Transfer your local file up to the server in the /home/ghost/ghost directory.

Now unzip the ghost files:

unzip ghost-0.3.0.zip

Now install the Ghost Node app:

npm install --production

7. Install Nginx

Now it's time to install the Nginx web server. We'll use Nginx to make Ghost visible to the world via our domain name.

What is Nginx?

Nginx (pronounced engine-x) is a free, open-source, high-performance HTTP server. It's lightweight and reliable. You may have heard of Apache before. Nginx serves the same purpose.

Let's get ready to install Nginx. First exit from the ghost user back to root. Then add the repository where Nginx will be found to the package manager:

(note in the command below, the http:// needs an extra slash. Ghost auto completes anchor tags so I had to leave the slash out to avoid the html in the code)

exit
rpm -Uvh http:/download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Now install Nginx:

sudo yum install nginx

Note: you'll have to answer "y" to a couple of dependency downloads in this process.

8. Configure & Start Nginx

Now that Nginx is installed, we need to configure it to serve up content from the Ghost app.

Edit the default Nginx server configuration (thanks to LeeH in the Ghost forums for these tips):

vi /etc/nginx/conf.d/default.conf

vi is a text editor. Type "i" to enter insert mode to change text.

Now edit the server_name variable to contain your domain name:

servername  your.blogaddress.whatever;

Now remove the lines between location / { } and add these lines instead:

(note in the command below, the http:// needs an extra slash. Ghost auto completes anchor tags so I had to leave the slash out to avoid the html in the code)

location / {                                                             
        proxy_pass \htp://localhost:2368/;                               
        proxy_set_header Host $host;                                     
        proxy_buffering off;                                             
}                                                                        

Type :wq to exit vi and save your changes.

Now start Nginx:

sudo /etc/init.d/nginx start

9. Start Ghost

Now let's start Ghost:

su ghost
cd /ghost/
npm start

Ghost is now running! Go to your domain name and you should see the default Ghost installation with a single "Welcome to Ghost" post like this:

The Ghost Default Page

10. Sign in to Ghost and start writing!

Create your first user on Ghost at [your domain]/ghost/signup.

Now you can start using Ghost. More instructions about configuration are available on the Ghost site.

Bonus Tips

You'll also want to edit the config.js file in the Ghost directory to set your blog's URL (and dismiss that "development mode" message you'll see in the Ghost admin pages).

And finally, to run Ghost automatically in the background, I recommend using a node package called Forever, which will keep your Ghost node app running continuously.

Install Forever with this command:

npm install forever -g

Then you'll start Ghost with this command (enter from within the Ghost directory):

forever start index.js

Now Ghost will keep running in the background, even if you quit your terminal sesssion.

You can stop Ghost with a "forever stop index.js" command.


I hope this tutorial was helpful. Leave a comment below if you have questions and I'll do my best to answer.

Wait, it looks like Ghost doesn't have a commenting system yet :) Write me on Twitter (@corbettbarr) with questions or comments. Or, leave a comment on this thread in the Ghost forums.

Web Analytics