Install NodeBB on DigitalOcean Cloud In 5 minutes

In today’s tutorial we will install NodeBB on DigitalOcean cloud in just 5 minutes. Yeah, It’s different but these days serverside Javascript software are trending. The reason behind is their ability to handle real-time communication with minimal effort and resources. JavaScript is, however, not my expertise but hey we do not need to learn about JavaScript. We will simply install  NodeBB on DigitalOcean with little effort.

install-nodebb
How to Install NodeBB on DigitalOcean

There is already some good article written about installing NodeBB on different environments. One of the easiest was from Andrew Rodrigues, co-founder of NodeBB, itself. But that seems to be old and there are many points which should be updated now. I will extend that article more or less. Feel free to inform me if anything needs attention.

*Disclaimer: That’s a referral link. But if you sign up DigitalOcean using my link then you will also get $10 credit. This credit will be enough for 2 months hosting.

Let’s install NodeBB in 5 Minutes

NodeBB, a forum software for instant interaction and real-time notifications, runs on server-side JavaScript program called NodeJS. The beauty of NodeJS is to handle thousands of concurrent users with a single process. It is incredibly fast but might be totally new for WordPress users.

Let’s install NodeBB on tiniest DigitalOcean server with 512Mb RAM. Even this droplet (the server) will be good to start. You can scale it anytime or as required.

Create Server and Initial Server Setup

Sign up DigitalOcean and create your first server. Here they call it a droplet. The droplet creation is pretty easy and the creation window look similar to the image below. Select

  1. Operating System – Ubuntu 14.04 (or later)
  2. Droplet Size – 512 MB (or more if you like. they will highlight 1GB droplet by default)
  3. Host Name – Something easy. Let’s consider alpha

You may leave all other options intact OR change as per your need.

DigitalOcean-Create-Droplet

DigitalOcean will send you an email with login credentials upon successful droplet creation. We will need these credentials to login to the droplet via SSH.

Log into Server

To log into your server we need a tiny software called PuTTY. It’s free and can be downloaded from here. (Simply download PuTTY for For Windows on Intel x86. It will work fine on any Windows OS. Linux and Apple users do not need PuTTY.

putty-login

PuTTY window looks like the screenshot above. Simply enter IP Address (as provided in DigitalOcean email), port 22 and select connection type SSH.

Once you hit open you will be connected and asked for login as. Enter root as your username and then password (the one you received in email).

login as: root
[email protected]'s password:

Once you successfully logged in you will be asked to change password for root. Enter current password and then new password twice. Even if the terminal do not ask to change the password, you may change it by entering following command for logged in user:

passwd

Create a user with sudo privilege:

Now, run the following commands to add a user of your choice. I have used bill for this tutorial. (Do not copy the # or $ sign from any of the following commands. Also do not change directory unless your are told to do so or you are sure about it.

adduser bill

You will be asked to enter a few details about username bill. Except password leave other options blank and hit enter. Once the user is created run the following command to give it superuser privilege.

adduser bill sudo

Now, logout with the command logout.

Install Dependencies and Prerequisites for NodeBB

Open a fresh PuTTY terminal and login with the user id bill (or yours, if you have created something else) and run the following command:

sudo apt-get update

It will update the packages but take a few seconds to complete. After completion run the following command various software and dependencies including git, nodejs, npm, redis-server and nginx.

sudo apt-get install git nodejs npm redis-server nginx build-essential imagemagick

It will take about a minute to install. Since Ubuntu has another package called node, we have to create symbolic link for nodejs. run the following command:

sudo ln -s `which nodejs` /usr/local/bin/node

Notice the backticks in the above command. It’s not single colon.

Install NodeBB on DigitalOcean

Now we have completed installing all the dependencies for NodeBB. So it’s time to install NodeBB but first create a directory for it. In the tutorial we will install our forum in a dedicated directory called forums. You may change it to what so ever to identify easily.

sudo mkdir -p /var/www/nodebb/forums

And Then

cd /var/www

Now, the prompt will be like this: [email protected]:/var/www$. It’s time to change the ownership of the directory to bill.

sudo chown -R bill:bill nodebb

If you have some other user name created change it accordingly. Now run

cd nodebb

It’s time clone NodeBB to the forums directory with following command

git clone git://github.com/NodeBB/NodeBB.git forums

Now move to the directory forums and install NodeBB. To do so run the following commands one by one:

cd forums
npm install

In the following command you will be asked for NodeBB configuration. Here we will only have to configure ip address and rest should be left blank. The IP address is same as your server ip, configure accordingly. The setup is like this. Later you will be asked for a Admin account, enter your desired login id and password to log into forum. Run

node app --setup

Once the setup is complete, run the following command to start the forum:

node app

At this level you might encounter similar error:

 15/12 01:50 [12503] - error: Your Redis version is not new enough to support NodeBB, please upgrade Redis to v2.8.9 or higher.
 [cluster] Child Process (12503) has exited (code: 0, signal: null)

To fix the above issue we have to upgrade redis to a later version. Add chris-lea/redis-server repository with following command. The repository is recommended by NodeBB itself.

sudo apt-add-repository ppa:chris-lea/redis-server

Now update repositories:

sudo apt-get update

and then install updated version of redis with the help of following command:

sudo apt-get install redis-server

Again run

node app

This time everything should be fine and we have successfully installed NodeBB on DigitalOcean. Your forum will be available on http://<droplet-ip=address>:4567

As you have seen it it really easy to install NodeBB on DigitalOcean droplet we will configure Nginx to act as NodeBB Proxy in the next post. If you face any issue leave a comment below or want to take a preview of a NodeBB forum on 512MB DigitalOcean droplet head to our forums. It’s pretty new and I would appreciate to leave a comment or join our forums.

In the Series:

  • How to Install NodeBB on DigitalOcean Cloud In 5 minutes ← You are here
  • Add NGINX Proxy to add your domain name. (Required)
  • Disable root login (Highly Recommended)
  • Change SSH Port (Highly Recommended)
  • Add firewall (Highly Recommended)

 

Published by

Anand Kumar

I am the person behind this site.