Ensure you have installed MongoDB before progressing any further..

sudo apt install mongodb

When your server has finished being generated, you will receive an email with your server IP address, root user (usually root) and your password. You can then connect to the server with PuTTy.

Create a MongoDB database and user

Like all good applications, MongoDB has a built-in console tool that allows us to quickly communicate with the application. To access the MongoDB console type:

  1. $ mongo

Creating a MongoDB database is extremely easy, to create one called ‘nodebb’ issue the following command.

  1. $ use nodebb

To create a user called ‘nodebb’ that has access to our nodebb database, issue the following command:

db.createUser( { user: “nodebb”, pwd: “your-strong-password”, roles: [ “readWrite”, “dbAdmin” ] } )


Install Nodejs

The following command will install v4.2 Argon.

  1. $ sudo curl -sL https://deb.nodesource.com/setup_4.x sudo -E bash -

Then install Nodejs and some dependencies

  1. $ sudo apt-get install -y git nodejs mongodb build-essential

Navigate to where you want NodeBB to live. Personally, i use /var/www, but you can use whatever you like.

  1. $ cd /var

  2. $ mkdir www

  3. $ cd www

  4. $ git clone -b v1.x.x https://github.com/NodeBB/NodeBB.git nodebb

Next, we will install NodeBB and obtain its dependencies

  1. $ cd nodebb
  2. $ npm install –production

Next, we will run the NodeBB setup. This is where you will enter your MongoDB username, password and database. You will then be asked for an administrator user, email and password.

  1. $ ./nodebb setup

Finally, we can start NodeBB by running:

  1. $ ./nodebb start

You should then be able to access your NodeBB installation by visiting http://ip-address:4567

However, this is not desirable and we will almost always want to use a domain name. So lets now configure Nginx to handle requests from the internet.

Install Nginx

  1. $ sudo apt-get update
  2. $ sudo apt-get install nginx

That’s it, Nginx is now installed and you can do the usual start, stop and restart with the following command:

  1. $ service nginx start

  2. $ service nginx stop

  3. $ service nginx stop

Configure Nginx

Nginx is going to act like a reverse proxy for your domain. When a user types in your-domain, they are going to serves the pages from your-ip:4567. To do this, you will need to navigate to your configuration file.

  1. $ cd /etc/nginx/sites-available/

Personally, I remove the configuration and create a new one.

  1. $ rm default
  2. $ nano default

Inside the configuration file I use the following:

server { listen 80; server_name domain.com; location / { root /var/www/nodebb; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection “upgrade”; } }


You will need to change domain.com to your own domain name and the root path to wherever you installed NodeBB.