journey · linux · server · ubuntu

Setting up Journey on Ubuntu Server

Journey was written to be easily deployable on any machine. Most people will probably use it on a Linux server though. That’s why I wrote a step-by-step tutorial on how to set up Journey on your Ubuntu server.

1. Download and Extract Journey

Go to https://github.com/kabukky/journey/releases and copy the link to the latest Journey release package for your platform (linux-amd64 or linux-386 for Ubuntu Server). We will be using the linux-amd64 package in this tutorial.

On the server, log in as your standard user (not root).

In your home directory, run:

wget https://link/to/latest/release/journey-linux-amd64.zip

This will download the zip file to your home directory. Then run:

unzip journey-linux-amd64.zip

This will extract the file. You can delete the zip file now:

rm journey-linux-amd64.zip

Then rename the extracted folder from “journey-linux-amd64” to “journey”:

mv journey-linux-amd64/ journey

After that, change into the journey folder:

cd journey

2. Configure Journey

Use your favorite text editor to edit the “config.json” file. We will be using nano in this example (if you don’t have nano installed, run sudo apt-get install nano). To edit the file, run:

nano config.json

Then change the values to reflect the following settings (replace “www.kaihag.com” with your own url):

{
"HttpHostAndPort":":80",
"HttpsHostAndPort":":443",
"HttpsUsage":"AdminOnly",
"Url":"https://www.kaihag.com",
"HttpsUrl":"https://www.kaihag.com"
}

A short explanation: - The “HttpHostAndPort” and “HttpHostAndPort” settings will set the ports Journey is listening on. We changed them to the default HTTP and HTTPS ports. - “HttpsUsage” tells Journey how redirection to HTTPS should be handled. “AdminOnly” forces the admin area to be transmitted via HTTPS for security. The other settings are “None” (no HTTPS support) and “All” (all connections both to the admin area and to the blog are forced to HTTPS). - The “Url” setting will be used by Journey to generate links to your blog (e.g. in the rss feed). This can be an HTTP or HTTPS address. - The “HttpsUrl” setting will be used to redirect incoming HTTP connections to HTTPS. This is almost always the same value as “Url” unless you are using a non-standard port for HTTPS.

Ctrl + X will exit nano. Don’t forget to save the file.

3. Create and Run the Journey Daemon

We will be using setcap to grant special privileges to the Journey executable. This will allow us to run Journey through our default user while still being able to bind to low ports (80 and 443, which only root can bind to).

Install setcap by running:

sudo apt-get install libcap2-bin

After that, we’ll create a new upstart script. Upstart is the Ubuntu init daemon that starts and supervises tasks on the system. It’ll start Journey after a reboot and keep it running. However, it is slowly being replaced by systemd. If your Linux distribution ships without upstart, you can use a multitude of alternatives including systemd, restartd, supervise (daemontools), monit, supervisord, or write an init script and place it in /etc/init.d.

Here’s how you create the upstart script. Again, using nano as the editor:

sudo nano /etc/init/journey.conf

Paste in the following text (and replace every occurrence of “youruser” with your own user name):

# Journey Daemon

description "Journey Daemon"
author      "kabukky"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
console none

pre-start script
    setcap 'cap_net_bind_service=+ep' /home/youruser/journey/journey
end script

exec su - youruser -c "/home/youruser/journey/journey"

Ctrl + X will exit nano. Don’t forget to save the file. Note that this example assumes your journey executable is located in your home directory in a folder named “journey”.

Finally, we’ll start our newly created Journey service with:

sudo service journey start

And we’re done! Journey is now running in the background and will be started automatically after a reboot, crash, etc.

4. Use Journey

Visit your url in your browser (the one you provided in the “config.json”, remember? You have to point it to your Linux server of course). You’ll be presented with your new Journey blog in all its glory.

To create your admin account, visit:

https://yourblogurl/admin

and enter your details. Your browser will probably show you a warning/error about the certificate. This happens because Journey has generated its own certificate upon start up. You can add an exception to your browser if you wish.

However, to make your blog accessible to all readers using https, you’ll need to generate certificates via a trusted CA (certificate authority). A free one would be StartSSL. Consult this Journey Wiki article on how to set up a StartSSL certificate.

After you have acquired those, place the certificate and matching private key as “cert.pem” and “key.pem” in the content/https folder of your Journey installation (e.g. /home/youruser/journey/content/https), overwriting the old ones.

After that, restart Journey to load the new certificates:

sudo service journey restart

5. Customize Your Blog

The Promenade theme is included by default to make Journey work out of the box. However, it is only intended to be used on a one author, personal website.

For a fully fledged, multiple author blog experience try the Casper theme from the makers of Ghost.

Download it and place the Casper directory in the content/themes folder of your Journey installation (e.g. /home/youruser/journey/content/themes). Then select Casper from your admin panel under Settings/Blog.

After that, try some other themes. There’s a whole world of Ghost themes out there. Find the one you like best.

6. Write Your Own Theme

Finally, you can always write your own theme and use it with Journey. Start by visiting http://themes.ghost.org and by reading one of the many tutorials that show you how to create a Ghost theme.

Published:
comments powered by Disqus