Install Ghost on Linux

Ghost is a fabulous new open-Source and non-profit-based blogging platform. This is a short tutorial on how-to install ghost on Linux Mint/Ubuntu or any other Linux system. This tutorial works sucessfully on Mint Linux 15, CentOs/RedHat or Ubuntu 14.04.

There exists an official installation doc at docs.ghost.org, however it still does not work, even now that it is August 5th 2014.

If you run into the following error when trying to start ghost ..

module.js:333 throw err; ^ Error: Cannot find module ./core/config-loader.js’.

or

sqlite3@2.2.0 install /Users/a000/Downloads/ghost-0.4.2/node_modules/sqlite3 node-pre-gyp install --fallback-to-build

If you get above errors you did most probably follow the official ghost install instructions. They leave out dependencies related to node 10.x and re-direct you to install node 11.

Installation

This is how I would suggest to proceed and how to make sure you have the correct versions of node and dependencies installed.

Compile node.js

Checking out node should create a new directory. Better don’t delete the folder after you are finishedwith compiling it in case you want to do a “make uninstall” later. This approach is always a good idea if you compile from source.

git clone https://github.com/joyent/node.git && cd node && git tag | grep v0.10.

Above command will clone into node’s git repository and give back a long list of v.0.10.x versions. Make sure to pick the latest one: v0.10.30 was the latest 10.x version at the time of writing.

Then issue a

git checkout v0.10.30 && python2.7 configure && make && sudo make install && node -v

This should give you back a v0.10.30 and install it. If not, you should make a symbolic link from /usr/bin/node to the location where node actually installed.

Why python2.7 configure - because node won't compile with python2.4, just in case you have a python2.4 installed, like on legacy RedHat or legacy CentOS. If you have to install python2.7 on CentOS make sure to use make altinstall, otherwise you will break CentOS. Better don't CentOS or RedHat, but there exist legitimate business-reasons for why you might have to.

Install ghost

Make sure no old ghost installs are present, then create a new ghost directory, preferably within your web server directory structure, but you could choose any destination.

To finally pull ghost do a

curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
unzip -uo ghost.zip -d ghost

Then finally a

npm install -production

You want to see this response:

[sqlite3] Success: "lib/node_sqlite3.node" is installed sqlite3@2.2.0 node_modules/sqlite3
└── node-pre-gyp@0.2.6 (rimraf@2.2.8, mkdirp@0.3.5, semver@2.1.0, ...

Run ghost

If there are no red-colored prompts or other errors you should be good to go for a npm start in your terminal window inside the ghost folder.

If you did however run into errors while following above instructions, you could try to reproduce the commands step-by-step and work your way through the errors with the help of the community at the official help forum.

If you have no errors and starting npm in the ghost install directory worked great, open a browser window and browse to http://127.0.0.1:2368/ and http://127.0.0.1:2368/ghost.

Plug-Ins

Google Analytics and Disqus

Plug-Ins do not work right now, because the API is not finished yet. In case you want to be ahed of the game and add Google Analytics, Disqus and other Cloud-services (consider the surveillance though), you can do so by editing the default.hbs file in your ghost theme directory.

You can use above technique and read the great tutorials about this at http://ghost.pellegrom.me/adding-disqus-comments-to-ghost/.

MathJax (Latex)

I successfully implemented MathJax into my Ghost install by putting the following call into default.hbs of my theme:

Now use the double $$ delimiter as described here http://docs.mathjax.org/en/latest/start.html. Even HTML5MathML worked, in case you want to score that distinction in your next university assignment by using advanced latex-based mathematical animations.

Have fun with ghost!