7 days of unlimited WordPress themes, plugins & graphics - for free!* Unlimited asset downloads! Start 7-Day Free Trial
  1. Computer Skills
  2. Electronics

Run the Ghost Blogging Software on a Raspberry Pi

Scroll to top
Read Time: 8 mins

In this tutorial I will show you how to host a blog on your Raspberry Pi using the Ghost blogging platform. Ghost is a brand new piece of blog software, currently under development which was recently funded by a Kickstarter campaign. Similar to the way Wordpress is distributed, you can opt to purchase a hosted blog or download the software to try out yourself.

As Ghost is very new it is still quite simplistic, and this simplicity makes it ideal to run on a Raspberry Pi. You'll be able to write and edit posts and upload images to your blog. I'll also show you how to install google analytics so you can see how many people are reading your website.


You'll need

  • a Raspberry Pi, model A or B running Raspbian
  • a basic understanding of using the console

Setting Up Your Raspberry Pi

The next steps all use the Raspberry Pi’s command line – this is the first thing you see after the Pi has booted up. If you’re running the Pi’s desktop you can access the command line by running the console app.

In order to test the Ghost blog once it's installed, it is necessary to find out the IP address of your Pi. If you haven’t already, make sure your Pi is connected to your home network – either with the ethernet cable, or with a WiFi adapter.

Run ifconfig to find out the IP address of your Pi:

This will display some information about how your Pi is connected to the network — for example:

The information you’re looking for will start inet addr:192.168.1. followed by a number – in the example above the IP address of the Pi is:

Make a note of the number, if you reboot your Pi this number will change so you’ll need to go through the steps again to find it. In this tutorial I’ll refer to this number as 192.168.1.n.

Tip: you can follow the steps in the tutorial, 'Take control of Your Raspberry Pi using you Mac, PC iPad or Phone' to set up your Raspberry Pi to work over your home network and provide it with a static IP address, then you will not need to repeat these steps every time you reboot your Pi.

Install node.js

First node.js must be installed: in the terminal type:

To test that node has installed correctly type:

This should return the version number v0.10.5

Installing Ghost

Next I'll create a directory to install into:

For the next step  download and install ghost-0.3.1 from the Ghost website – you will need to log in and create and account. You can do this using the Midori web browser on the Pi's desktop, or from another machine. Save the zip archive ghost-0.3.1.zip in the ghost folder you've created.

Unpack and install ghost:

The second two steps take a few minutes to run, so be patient and don't interrupt the process.

Once your Ghost blog is running, you should see the message

Next open a browser on the Pi and enter the address:


and all being well you should see an intro page:

The default Ghost blog screenThe default Ghost blog screenThe default Ghost blog screen
The default Ghost blog screen

Accessing Your Ghost Blog Over Your Local Network

The built in browsers on the Pi are a bit slow for blogging (particularly via a VNC connection) so to speed things up you can access your blog over your local network, Ghost also works well on a tablet or smart phone.

If Ghost is still running press the Control and C keys, simultaneously, in the terminal to shut down.

In the /ghost directory edit the < strong >config.js file.  You will need to edit this file using the IP address you found in the very first step, or the static IP address of your Pi if you have set it up to use one.

This will launch the nano text editor - use the cursor keys to look for this text:

replace host: ’′ with host: ‘<your IP address>’ and port: ’2368′ to port: ’80′.

Control X to exit and answer yes and press enter to write out the file.

Enter your Pi’s IP address onto another computer on your network – you should now see your Ghost blog.

Note that if you want to view your Ghost blog on your Raspberry Pi itself, you will now need to use the same address instead of localhost.

Login and Edit Your First Blog

Now you have Ghost up and running, you can start writing. To edit your blog, you login by entering the following address:

http://(your PI's IP address)/ghost/signup/

Enter your name and email address, along with a password.

Tip: Note that that there is a delay of 60 seconds between clicking the sign up button, and Ghost loading the edit screen.

Once you have created an account, you will see the default edit screen:

Editing a Ghost BlogEditing a Ghost BlogEditing a Ghost Blog
The Ghost edit screen

To get started click on the pencil edit icon in the top right hand corner and have a go at editing the post. Ghost includes instructions on using markup and adding images.

Publish Your Ghost Blog on the Web

If you want to make your Ghost blog accessible to the web, and don't have a broadband account with a fixed IP address you can use a service called No IP to point a domain name at your blog. Most ISP’s use dynamic IP addresses which are assigned each time you connect to the internet so NoIP uses a program that runs on the Pi to update where the hostname is pointing.

You’ll also need to open a port in the home router to allow connections to the Pi.

NoIP offers a free service with free domain names, but you can also opt for a paid account with your own hostname. Bear in mind that your blog will be reliant on your home broadband connection and that this setup is not suitable for a high traffic website.

First sign up for an account at noip.com - there is a free option available, or you can opt to pay $15 a year for a service with more features.

Add a Host, and choose a Hostname from the list of options. Then choose the DNS Host (A) option and save. The settings I’ve been using are below.

No IP configurationNo IP configurationNo IP configuration

Next, on the Pi download and install the noip software:

Whilst installing it will prompt you for your noip.com login details.

Finally you need to open a port in your router to allow traffic through –- there is a port forwarding guide for most routers available here – typically opening the Router’s configuration in your browser, finding the advanced menu and adding the local IP address of my Pi 192.168.1.n and HTTP Server (World Wide Web) to the forwarding option.

Keep an Eye on Your Blog With Analytics

At time of writing, the Ghost blogging software dashboard has yet to be implemented; in the longer term this will provide feedback about who is reading your blog.

In the meantime there are two services that you can use to keep an eye on your blog, and measure the number of people reading your posts.

UptimeRobot is a free service which measures the response time of your website, and can alert you if it stops responding. Sign up for an account and choose the http(s) option, and just enter the address of your blog. Over time UptimeRobot will generate a graph of your website's response time:

Ghostpi.org response time tracked on UptimeRoboGhostpi.org response time tracked on UptimeRoboGhostpi.org response time tracked on UptimeRobo
Ghostpi.org response time tracked on UptimeRobot

For more detailed statistics you can add Google analytics to your blog. You will need to sign up with a free google analytics account and create a profile.

You will need to edit a file in the Ghost directory - you can either do this in the Pi desktop, or on the command line using:

The file you need to edit is default.hbs

Search for the footer text - it looks something like this:

Then add the google analytics javascript code just after the </div> tag.


In this tutorial I have shown you how to host a Ghost blog using a Raspberry Pi, make it available on the web and add some analytics. Ghost is an interesting introduction to hosting websites using node.js, and provides a useful way of enabling your Pi to publish information on the web.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Computer Skills tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.