How to Install NodeBB on Ubuntu 18.04

In this article, we will show you how to install NodeBB on an Ubuntu 18.04 VPS.

NodeBB is an open-source forum software that runs on Node.js platform that is free and easy to use. It is great for powering any kind of community forums, discussion, or bulletin boards. NodeBB utilizes web sockets for instant interactions and real-time notifications.


  •  An Ubuntu 18.04 VPS
  •  Node.js
  •  Database – We’ll be using MongoDB in this tutorial
  •  Nginx web server
  • SSH access with root privileges

Step 1: Connect to Your Server

To connect to your server via SSH as the root user, use the following command:


and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

$ apt-get update
$ apt-get upgrade

Step 2: Install Node.js

On Ubuntu systems, you can install Node.js from the NodeSource repository:

$ apt-get update
$ apt-get install curl git gcc g++ make

After that, install the Node.js repository with the following command

curl -sL | sudo -E bash -

After that, run the commands below to install Node.js:

$ apt-get install nodejs

That should install version 10 of Node.js alongside ‘npm’. You can verify versions using:

$ node -v
$ npm -v

Step 3: Install MongoDB

MongoDB is the default database for NodeBB. Start the installation by importing the public key used by the package management system.

$ apt-key adv --keyserver hkp:// --recv 9DA31620334BD75D9DCB49F368818C72E52529D4

Add the MongoDB repository:

echo "deb [ arch=amd64 ] bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb.list

Update the apt package index and install the MongoDB server:

$ apt-get update
$ apt-get install -y mongodb-org

Start the MongoDB service:

$ systemctl start mongod.service
$ systemctl enable mongod.service

Verify installation of MongoDB. You should have at least version 4.0:

$ mongod --version
db version v4.0.6
git version: caa42a1f75a56c7643d0b68d3880444375ec42e3
OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017
allocator: tcmalloc
modules: none
build environment:
    distmod: ubuntu1804
    distarch: x86_64
    target_arch: x86_64

Step 4: Configure MongoDB

Log in to MongoDB running the following commands:

$ mongo

Then switch the db to ‘admin’ and create a new admin user…

use admin

Create a new admin user named ‘admin’ with a new password…

db.createUser( { user: "admin", pwd: "admin_password", roles: [ { role: "readWriteAnyDatabase", db: "admin" }, { role: "userAdminAnyDatabase", db: "admin" } ] } )

Don’t forget to replace ‘admin_password‘ with a strong password.

Next, create a new database called nodebb

use nodebb

Then create a new NodeBB user named ‘nodebbuser’ with rights to administer the database…

db.createUser( { user: "nodebbuser", pwd: "strong_password", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )

Once again, don’t forget to replace ‘strong_password‘ with a real, complex password.

After that, exit the MongoDB shell.


After that, run the commands below to open MongoDB config file…

$ nano /etc/mongod.conf

change the highlighted line to enabled.

# network interfaces
  port: 27017

# how the process runs
  timeZoneInfo: /usr/share/zoneinfo

authorization: enabled




when you’re done, save your changes.

Step 5: Install Nginx

NodeBB can work just fine with many web servers. In this tutorial, we will configure it to work with Nginx, one of the most customizable web servers around.

To install Nginx on your Ubuntu 18.04 server, you need to execute the following command:

$ apt-get install nginx

After the installation is completed, start Nginx and enable it to start automatically after a reboot with these two commands:

$ systemctl start nginx.service
$ systemctl enable nginx.service

Step 6: Install NodeBB

Go to the newly created directory by executing:

$ cd /var/www

Clone NodeBB in this directory by running this command:

$ git clone -b v1.12.0 nodebb

*replace v1.12.0 with the latest version.

Create a new nodebb user:

$ useradd nodebb

Now apply the recommended file and folder permissions of the /var/www/nodebb directory to the nodebb user:

sudo chown -R nodebb:nodebb /var/www/nodebb

Enter the nodeBB directory with

$ cd nodebb

Initiate the installation by using the following command:

$ ./nodebb setup

Answer each of the questions. This will install modules from npm and then enter the setup utility.

Now start NodeBB with this command:

$ ./nodebb start

Starting NodeBB
  "./nodebb stop" to stop the NodeBB server
  "./nodebb log" to view server output
  "./nodebb help" for more commands

Step 7: Create a systemd Unit File

This step will let us run NodeBB as a service within systemd. This allows us to have it start up on boot, as well as run independently of our terminal session.

If it’s already running, stop NodeBB:

$ ./nodebb stop

In the next step, we will create a service unit file so that we can run NodeBB as a service.

Open your text editor (we’ll use nano):

$ nano /etc/systemd/system/nodebb.service

and paste the configuration below:

 After=system.slice multi-user.goal mongod.service
 ExecStart=/usr/bin/env node loader.js
 Restart=at all times

Save and exit the file. You now need to reload the daemon so that the system can take the new unit that we created for systemd.

$ systemctl daemon-reload

Finally, we can start the NodeBB instance with the command:

$ systemctl start nodebb

To check the status for the NodeBB service you can execute the following command:

$ systemctl status nodebb

Step 8: Configure Nginx

NodeBB by default runs on port 4567. We will configure Nginx to proxy requests to it.

Create an Nginx configuration file:

$ nano /etc/nginx/conf.d/nodebb.conf

Then add the following content:

    server {
    listen 80;


    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

NOTE: Replace ‘‘ with your registered domain name.

Now, check the config file to make sure that there are no syntax errors. Any errors could crash the web server on restart.

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99

$ nginx -t


nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If there are no errors, you can reload the Nginx config.

$ systemctl reload nginx

Step 9: Access the NodeBB Web Interface

At this point, you should have successfully installed NodeBB on your Ubuntu 18.04 server. You should be able to access and interact with your forum.

To access the admin dashboard, use instead and use the credentials you set earlier.

If you followed the steps correctly, then you should have a successful copy of NodeBB running on your server.

Of course, you don’t have to install NodeBB on Ubuntu 18.04 if you have an Ubuntu VPS with us. You can simply ask our support team to install NodeBB on Ubuntu 18.04 for you. They are available 24/7 and will be able to help you with the installation.

PS. If you enjoyed reading this blog post on how to install NodeBB on Ubuntu 18.04, or if you found it helpful, feel free to share it on social networks using the shortcuts below, or simply leave a comment in the comments section. Thank you.

Leave a Comment