How to Install Ghost on Digital Ocean

Ghost Logo

We’ve written several times about Ghost – a new blogging platform.

Once Ghost is installed, it’s really easy to use.

However, being built on Node.js, which is a relatively new technology, installing Ghost is not as simple as installing WordPress.

That said, hosting companies and many developers have been quick to create one click installers and guides to help new Ghost users.

In this tutorial, we’ll walk you through how to install Ghost on the Digital Ocean platform.

Some ways to install and use Ghost

We had earlier covered on how you could install Ghost locally using Bitnami’s 1 click installer. In case you are already using Node.js, you can also directly save Ghost locally, by following the installation guide provided on Ghost.org.

Using Ghost hosted platforms

If you just want a Ghost blog and do not want to worry about upgrades, security and server upkeep, you could opt for the official Ghost hosting platform “Ghost Pro”. Starting at $5/month, this platform offers backup, auto upgrade and the ability to upload any custom theme.

Installing on a remote server

Ghost can be installed on a variety of platforms such as Amazon EC2 or on regular dedicated and VPS servers. Many shared hosting companies like “A Small Orange”, also offer one click installation. In this article will only cover installing and setting up Ghost on DigitalOcean and setting up a custom domain to work with it.

Installing Ghost on DigitalOcean VPS

DigitalOcean-200x121Before we go through the steps, let me explain why I choose DigitalOcean for this article. There are many different companies offering low cost VPS solutions. Amazon’s services cost nothing for the first year for low traffic sites. However when it comes to the simplicity of getting started, DigitalOcean offers the simplest interface to create VPS server instances.

Step #1. Getting Started

To get started head over to DigitalOcean’s registration page and signup for a new account.

After signing up, you would need to check your email and click on a link sent by DigitalOcean to verify your account. Before creating any VPS (droplets) you would be required to enter your billing details.

Step #2. Creating a Ghost Droplet (VPS)

installing-ghost-01.png

DigitalOcean refers to VPS as “Droplets”, hence from now we will use their terminology. To create your first droplet, click on the large green button labelled “Create”.

On the page that follows you would be asked to enter a hostname for your droplet and choose the type of droplet you wish to create.

  • Hostname: Use this field to enter a name to identify your droplet.
  • Droplet Size: Ghost runs on least amount of resources, hence to get started you can select the most basic option that costs $5 USD / month and offers 20 GB space.
  • Region: Here you can select the region closest to your target audience which will result in your blog loading faster.
  • Image: DigitalOcean offers different pre-built images to get started. For the purpose of this article, we would use an image created specifically for Ghost. Click on the “Applications” tab and then select the “Ghost on Ubuntu” image.
installing-ghost-02.png

Finally click on the “Create droplet” button which will start the droplet creation process. Within a minute, you would have a VPS ready with Ubuntu, Nginx, Node.js and Ghost pre-installed. You will soon also receive an email with the root login details for your server.

installing-ghost-03.png

After following step 1 and 2, you will now have a Ghost blog ready and accessible from anywhere via an IP.

Setting up Ghost is as easy as that. However, to get domain name to work with our new Ghost blog, we will need to perform some additional steps

Step #3. Login to your server

  • First, SSH into your server either through a desktop program like “PUTTY” for windows or you could also use the web based tool provided by DigitalOcean.
  • In your DigitalOcean dashboard, click on “Droplets” link on the left.
  • The page that opens next will show you the name and details of the droplet you previously created. Click on the dropplet name.
  • On the page that follows click on the “Access” tab.
  • Click on the blue button labelled “Console Access”.
  • After the console is loaded, you would be see a black console window. Simply click on it and press any key to activate the console.
  • Use the login details sent earlier via email to get access to your new server.
installing-ghost-04.png

Step #4. Change our Nginx configuration

Before modifying the configuration files we need to stop our Nginx and Ghost services:

•    Type service nginx stop to stop Nginx
•    Type service ghost stop to stop Ghost
•    Next type nano /etc/nginx/conf.d/default.conf to open the Nginx server configuration file.

installing-ghost-05.png
  • Update the default server name “my-ghost-blog.com” with your domain or sub domain name and after successfully editing the file, press ctrl + x to exit the editor. The editor will then ask you to confirm or discard the changes. Press y for yes and then press enter to save the changes.

Step #5. Update Ghost’s configuration

Now we’re going to edit Ghost’s config.js file. Similar to the wp-config.php file in WordPress, this file contains the Ghost installation, database and other details. This file also contains details of different environment such as production or development which allows same installation to be used with different set of database for testing purposes.

  • Type nano /var/www/ghost/config.js to open the Ghost configuration file in nano editor.
installing-ghost-06.png
  • By default we are using production environment, so scroll down to the production section.
  • Update url from http://my-ghost-blog.com to the domain you had set earlier in the nginx configuration file
  • After successfully editing the file, press ctrl + x to exit the editor
  • Enter y for yes
  • Click enter to save the changes similar to the earlier step.

We can now start our Nginx and Ghost service by using the following commands:

•    Type service nginx start to start Nginx
•    Type service ghost start to start Ghost

Step #6. Set up our domain’s DNS to point to this server

To point your domain to this new droplet, you could either use DigitalOcean’s name server and DNS management control panel or edit your existing DNS to add an A record and point the domain or a sub domain to our new ghost blog. To use DigitalOcean’s DNS refer to this guide.

After DNS propagation is completed, if you visit your domain/sub domain, you should be able to see your Ghost blog with a sample post.

Step #7. Sign into Ghost

installing-ghost-07.png

To login to your new Ghost blog, visit yourdomain.com/ghost.

As this is a fresh install, you will see a signup page. Enter your details and click on the “Sign up” button to finally access the backend of your blog from where you can now start creating new posts or update the blog settings.

SSH Commands for Ghost

  • service ghost start
  • service ghost stop
  • service ghost restart (restart is required after uploading new themes or add new files such as CSS or custom page templates to existing themes).
  • service ghost status (to check if ghost is running).
  • npm install –production (to be used to reinstall after upgrading)

Conclusion

While installing Ghost has been made simpler by many similar one click installers, there is yet no auto upgrade feature. You would need to connect to your server through SSH to perform various actions which if not done properly can cause issues. If you are simply looking for a Ghost blog, official hosted platform would be the best option but if you want more access and control to learn and experiment, installing your self would be a good learning experience.

In our next post, we’ll discuss Ghost’s admin area and current features.

Author

  • Harish Chouhan

    Harish is a designer & WordPress developer from Mumbai. He runs a web design agency "Dreams Media" and writes about random stuff on his personal website HarishChouhan.com.

0 0 votes
Article Rating
Subscribe
Notify of
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Danny
Danny
7 years ago

In production, should the database be changed to something like mysql or postgres running on a volume so that data isn’t lost of the droplet hosting ghost goes down?

Nick
7 years ago
Reply to  Danny

Good question, Danny!
MySQL would be a great option. Postgres has second class support in Ghost, so we wouldn’t recommend it.

2
0
Would love your thoughts, please comment.x
()
x