How to install Ghost blogging platform on Linux

Ghost is a relatively new blog publishing platform which started out as a £25,000 Kickstarter project. While WordPress is still the dominant blogging tool on the web, it has now evolved into a general content management platform with tons of third party developed features, and over time has become increasingly cumbersome and complex to maintain. On the other hand, now only a couple of months old, Ghost promises to remain as a pure blogging platform with slick user-centric publishing interface.

In this tutorial, I will describe how to set up Ghost blogging platform on Linux.

Install Ghost on Linux

Ghost is powered by Node.js. Therefore, first install Node.js on your Linux system. Make sure that the version of Node.js is 0.10 or higher.

Next, log in to http://ghost.org (sign-up needed), and download the source code of Ghost. Then follow the procedure below to install Ghost.

$ sudo mkdir -p /var/www/ghost
$ sudo unzip ghost-0.3.3.zip -d /var/www/ghost
$ cd /var/www/ghost
$ sudo npm install --production

Configure Ghost Before Launching

Before launching Ghost, create its configuration file located at /var/www/ghost/config.js as follows. Replace "YOUR_IP" with the IP address of your host.

$ cd /var/www/ghost
$ sudo cp config.example.js config.js
$ sudo sed -i 's/127.0.0.1/YOUR_IP/g' config.js

Test-Run Ghost in Development Mode

At this point, you are ready to launch Ghost.

Note that Ghost can run in two different modes: "development" and "production" modes. For safety, Ghost maintains configuration info of two modes separately in its configuration file (/var/www/ghost/config.js). For example, the two different modes use different database files (i.e., ghost-dev.db and ghost.db located in /var/www/ghost/content/data).

Use the following commands to launch Ghost. Ghost runs in development mode by default.

$ cd /var/www/ghost
$ sudo npm start

If Ghost is launched successfully, you should see the following output in the terminal, indicating that Ghost is running on <YOUR_IP>:2368.

Go to http://<YOUR_IP>:2368 on your web browser, and verify that you can see the following initial Ghost page.

Launch Ghost in Production Mode

After you have verified that Ghost runs okay, stop Ghost in development mode by pressing Ctrl+C. Now it is time to launch Ghost in production mode.

When you run Ghost in production mode, you can use Node.js module called forever, which allows you to daemonize Ghost, and run it as a background process.

To install forever module:

$ sudo npm install forever -g

Finally, launch Ghost in production mode as follows:

$ cd /var/www/ghost
$ sudo NODE_ENV=production forever start index.js

Verify that Ghost's database is successfully created in production mode (/var/www/ghost/content/data/ghost.db).

You can also check a list of active forever processes.

$ sudo forever list
info:    Forever processes running
data:        uid  command         script   forever pid   logfile                     uptime       
data:    [0] cH0O /usr/bin/nodejs index.js 15355   15357 /home/dev/.forever/cH0O.log 0:0:0:37.741 

If you see output like the above, it means that Ghost is running in the background successfully.

To stop Ghost daemon, run the following command.

$ cd /var/www/ghost
$ sudo forever stop index.js

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.
Your name can also be listed here. Write for us as a freelancer.

3 thoughts on “How to install Ghost blogging platform on Linux

  1. In my opinion, Ghost will be great for those that prefer a simple solution. Compared to WordPress, it's much more following the KISS principle.
    WordPress has become a huge project which is much more than just a blogging platform. It has become a complete content management solution. So for users who don't need that and just want to blog, it might be a viable alternative.

  2. Having played with Ghost for a few hours, I do not see it as a viable contender, it is too simplistic. Added to that, the current release number is 0.3, so it hasnt even hit a proper release number, yet there seems to be no mention of it being a beta (at best I would rate the current release as alpha).

    On their site it mentions the dashboard that you see when you login, hmm, where is that exactly? I know several people that have installed it, and when they login it goes straight to the new post page, no dashboard at all.

    I really feel that the team should have waited another couple of months before releasing this to the wild and had it ready for a version 1.0 rather than releasing it to the wild as version 0.3 without any mention that its still beta (nah, it's alpha really)

    • All you have to do for dashboard access is add /ghost/ to your url. True, it may be too early to tell. But with close to $0.3m put into the project, it shouldn't be going nowhere.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *