Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

Costas Zarifis


Tutorials, code snippets, hacks and turtles... A lot of turtles... Heh.

Installing Ghost on Ubuntu

Ghost Image

So a while back I started keeping notes using the markdown format. It's without a doubt a very convenient and easy to use format and you can take notes that look magnificent without spending a huge amount of time trying to make it work. Yes I'm looking at you LaTeX.

Apart from the note-taking part I started using it to document stuff I'm doing. Installing packages, playing around with virtual machines and so on, it just made everything seem so easy, and that brings us to now. I ended up with a huge collection of markdown documents and with literally no way of quering them if I wanted to redo something that I've documented, and then it hit me.

Hmm… What if there was a blogging platform that would work natively with markdown.

No, format changes, no hassle, it would just work. Wait a minute! This thing already exists!

It's called Ghost!

Ok I'll be fair. At first I had a peak at dropplets but let's be honest, there is really no comparison.

Anyways, without any further ado here is a guide to install Ghost on your own server.

I'm assuming that you are using Ubuntu as the Operating system and that you already have an apache server installed, so if you need to do some extra steps for those, go ahead do that and get back here!

Before we start downloading Ghost let's make sure that node.js is installed as well. Try out the following:

 sudo apt-get install nodejs

If that doesn't work then you should probably do this:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Install npm:

sudo apt-get install npm

You might also need to install nodejs-legacy (I didn't have to):

 sudo apt-get install nodejs-legacy

OK, now download Ghost:

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

Unzip it and place it on the right dir:

unzip -uo ghost.zip -d ghost
rm ghost.zip

Install Apache2 server:

sudo apt-get update
sudo apt-get install apache2
mkdir /var/www/blog.yourdomain.com
reboot now

After rebooting do the following:

cp -r ghost/* /var/www/blog.yourdomain.com
cd /var/www/blog.yourdomain.com

If you don't have sqlite then you probably need to do this:

npm install sqlite3 --build-from-source

Install it:

npm install --production

copy the sample config file;

cp config.example.js config.js

Access it and change the fields that are relevant to your URL.

And start it:

npm start

This should do it! However, now Ghost runs locally and there is no way to access it from the internet. Ok let's fix that! Press ctrl+c for now.

sudo su
a2enmod proxy proxy_http
/etc/inid.d/apache2 restart
vim /etc/apache2/sites-available/blog.yourdomain.com    

This is the configuration file:

<VirtualHost YourIpAddress:80>
    ServerAdmin your@email.com
    ServerName  blog.yourdomain.com
    ServerAlias blog.yourdomain.info
    # Indexes + Directory Root.
    DirectoryIndex index.php
    DocumentRoot /var/www/blog.yourdomain.com/
    ProxyRequests Off
    ProxyPass / http://127.0.0.1:2368/
    ProxyPassReverse / http://127.0.0.1:2368/
    ProxyPreserveHost On

    <Proxy *>
            Order deny,allow
            Allow from 127.0.0.1
    </Proxy>

</VirtualHost>

Ok almost done:

sudo a2ensite blog.yourdomain.com
/etc/init.d/apache2 restart

Cool! now there are a lot of ways to run Ghost in the background I used tmux:

sudo apt-get update
sudo apt-get install tmux
tmux
cd /var/www/blog.yourdomain.com
npm start
ctrl+b and then d


sudo npm install forever -g

About the author

Costas Zarifis


Discussions

comments powered by Disqus