installing Ghost on Ubuntu Server

Ghost is an Open Source application which allows you to write and publish your own blog. It's simple, elegant, and designed so that you can spend less time making your blog work and more time blogging. Right now to use Ghost you'll have to download it and install it yourself.

Update Ubuntu Server

Of course, start by ensuring your server is up-to-date:

sudo apt-get update
sudo apt-get upgrade

Install C Compilier

Before you will get anywhere installing node (and subsequently Ghost), you'll need to install a few packages:

sudo apt-get install build-essential libssl-dev curl git-core

If you don't do this, you'll likely encounter the following error when trying to ./configure node:

Node.js configure error: No acceptable C compiler found!

Install Python Utilities [OPTIONAL]

Gregg Housh's Ghost installation guude suggests a package for python:

sudo apt-get install python-software-properties

NOTE: I didn't experience any problems running the install using only Ubuntu's default python packages.

Install ZIP Archive Utility

Ghost is bundled as a ZIP archive, which vanilla installations of Ubuntu Server will need some help to open:

sudo apt-get install zip unzip

Choose a Software Directory

You'll need to decide for yourself where you wish to keep node and Ghost on your server. Good practice would be to defer to the Filesystem Hierarchy Standard, which suggests /usr/local is the appropriate place for use by the system administrator when installing software locally (ie, for applications installed only on this machine, not on every machine on the network).

cd /usr/local

Download and Install Node

Downloading:

You can get the lastest verison of node using this command:

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

I copied the link of the latest version at the time of writing this blog, and since I'll refernce the version extension (-v0.10.21) in the next step, I'll define this just to be explicit:

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

Extracting and Housekeeping:

To extract the downloaded tar archive:

tar -zxvf node-v0.10.21.tar.gz 

And just to keep things neat and tidy, I loke to mv the downloaded folder to a shorter name:

mv node-v0.10.21 node

Installing Node:

To install, first cd to the node/ directory, them it's as easy as 1, 2, 3:

./configure
make
make install

Download and Install Ghost

Downloading:

If you're still in the node folder, you'll want to cd .. back to /usr/local.

Next we need to make the ghost directory and then download and extract the archive. There is probably a faster, more elegant way of doing this, but here's the route I take:

mkdir ghost
cd ghost
wget https://ghost.org/archives/ghost-0.3.3.zip
unzip ghost-0.3.3.zip

Installing Ghost:

Installing ghost is super simple:

npm install --production

Configuring:

Once Ghost is installed, it will pretty much just work. That is, when I tested the installation on my local computuer, I could navigate directly to 127.0.0.1:2368 and see the programme working.

Working with a server may be a bit more complicated in some contexts. I use EC2, which doesn't allow me to pull up a browser window to view processes running on my localhost (at least, not without a lot of work). So before you can 'see' Ghost after installing it on your server, you'll have to make a few adjustments to your your configuration.

Assuming you haven't yet tried to spin up the programme, you'll need to copy the example config file as follows:

cp config.example.js config.js

Next, open the config.js for editing and find the section that applies for your purposes. Most references I have seen on the internet suggest starting directly with the ###Production section, where you'd need to change the following:

url:  'http://my-ghost-blog.com'
host: '127.0.0.1',
port: '2368'   

to

url:  '[your URL]
host: '[your IP Address]'
port: '[whatever you want]'

NOTE: The assumption here is that you have an URL domain name and a static IP address. For instance, I use the domain categori.se, and have set up Apache to direct my incoming traffic on tankar.categori.se to Ghost (which means that I can leave the default values for all but the url section and everything works great. If all that I were running on categori.se were ghost, I could enter my public IP address in host and use port: 80, which would open Ghost publically. Since I have a few other programmes listening on port 80, this approach isn't feasible for me (hence the Apache set-up). If you also have programmes listening on 80, but don't want to mess around with Apache, you could always assign Ghost to something like port: 8080 (or just leave the default port), but you would need to make sure that whatever port you chose is open to the server (i.e. by chaning your 'security group' or router settings).

Starting Ghost

With all of that out of the way, all we need to do is to start up Ghost. Assuming you're working from the 'production' environment, you'd need to specify that:

sudo npm start --production

Otherwise, you can intialize the default 'development' environment with the basic command:

npm start

References:

c compiler:
http://stackoverflow.com/questions/11659721/node-js-configure-error-no-acceptable-c-compiler
http://stackoverflow.com/questions/3329355/how-to-compile-install-node-jscould-not-configure-a-cxx-compiler-ubuntu

zip installation:

http://www.distrogeeks.com/install-zip-rar-7zip-ubuntu/

node and ghost installation:
http://docs.ghost.org/installation/linux/
http://www.howtoinstallghost.com/how-to-install-ghost-on-ubuntu-server-12-04/

tip about python tools:

http://0v.org/installing-ghost-on-ubuntu-nginx-and-mysql/#.Un-0Yflmh8E

reference for locating programmes in /var/local:

http://superuser.com/questions/90479/what-is-the-conventional-install-location-for-applications-in-linux


View or Post Comments