← back to the blog

Setting Up KeystoneJS in a Ubuntu 14.04 Droplet

Posted in KeystoneJS

Setting Up KeystoneJS CMS in Ubuntu

I wanted to play around with the KeystoneJS CMS. This is a simple, bare-bones CMS that is natively written in JavaScript. It took quite a bit of work to get it up and running, so this page documents the steps involved to get a real, live running version.

I could have developed this on the Raspberry Pi, but instead opted to use a virtual server hosted by Digital Ocean. They only cost $5 per month and the ability to save and restore snapshots is even faster than re-flashing the SD card on the R-Pi. Either way, all the setup and configuration was done on the command line using SSH.

So without further ado, here are the steps I needed to take to get KeystoneJS up and running on a Ubuntu 14.04 Droplet:

  1. Log in as root

  2. Setup Mongo DB by executing the following code: (adapted from this Digital Ocean tutorial)
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
    echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
    apt-get update && apt-get -y upgrade
    sudo apt-get install -y mongodb-org

  3. Install the following support packages:
    apt-get install make
    apt-get install git
    apt-get install g++

  4. Add a local user. In this case I’m calling him ‘trout’:
    adduser trout
    adduser trout sudo

  5. This is a great time to shutdown the VM and take a snapshot. (optional)

  6. Log in as your new user.

  7. Install NVM (to run older versions of Node and NPM).
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash

  8. Log out and log back in as your regular user (‘trout’).

  9. Install Node 0.10.40:

    Note: This will give you warnings that node and npm are outdated. Ignore these warnings. 0.10.13 is too old to work and 0.12.7 (latest as of this writing) will break KeystoneJS because it is too new. There may be other versions that work, but these are what I’ve tested.

    nvm install 0.10.40

  10. Install the Yeoman Keystone Generator:
    npm install -g generator-keystone

  11. Run the Yeoman Keystone Generator:
    yo keystone

  12. Follow the on-screen prompts. Just hit Enter if you want to accept all quickly accept all defaults and test if you can even get KeystoneJS running.

  13. Change directory and run KeystoneJS:
    By default KeystoneJS will install into a directory called ‘my-site’.

    cd my-site
    node keystone

  14. Access your new website view port 3000. If you’re using a Digital Ocean Droplet like me, you can simply type in the IP address is your web browser like this: http://555.555.555.555:3000. If you’re using a Raspberry Pi, use the IP address of your Pi.


These are the steps that I was able to take and get KeystoneJS up and running. I hope it helps other people from having to spend two days figuring them out, like it took me.