Install NodeBB Forum Software on Ubuntu 16.04 | 18.04 | 18.10 with MongoDB Support

NodeBB Forums is an open source community forum solutions for the modern web, and powers discussions on thousands of sites to drive user engagement.

When looking for a next generation forum platform that’s powerful and mobile-friendly, you might want to take a look at NodeBB Forums software… It’s simple, efficient and makes online discussion easy and fun… NodeBB is written in Node.js and require Redis or MongoDB database software.

Individuals and webmasters can use NodeBB Forums software to set up communities in minutes to stay in touch with group of people or ideas.

This brief tutorial is going to show students and new users an easy way to get NodeBB Forums working on Ubuntu 16.04 / 18.10 and 18.04 with MongoDB support.To get started with installing NodeBB Forum Software, please follow the steps below:

Step 1: Install Node.js

The first requirement for NodeBB forum software is to get Node.js installed. to do that, run the commands below.

sudo apt update
sudo apt install curl git gcc g++ make

After that, install Node.js repository by running the commands below.

curl -sL | sudo -E bash -

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

sudo apt install nodejs

That should install Node.js

Step 2: Install MongoDB Database Server

The next requirement is to get MongoDB installed. to do that, run the commands below to add MongoDB repository to Ubuntu, including its repository key.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ]  xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list

After that, run the commands below to install MongoDB

sudo apt update
sudo apt install mongodb-org

After installing MongoDB, the following commands can be used to stop, start and enable MongoDB service to start up automatically when the server boots.

sudo systemctl stop mongod.service
sudo systemctl start mongod.service
sudo systemctl enable mongod.service

Step 3: Create NodeBB Database

After installing MongoDB database server, go and create a new database for NodeBB Forum software. to do that, use the guide below:

Logon to MongoDB by running the commands below:

mongo

Then switch the the db 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" } ] } )

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: "new_password_here", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )

After that, quit.

quit()

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

sudo nano /etc/mongod.conf

change the highlighted line to enabled.

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


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

security:
authorization: enabled

#operationProfiling:

#replication:

#sharding:

when you’re done, save your changes.

Step 4: Install NodeBB Forum

Now that all NodeBB Forum software requirements are in place, run the commands below to download NodeBB

cd ~/
git clone -b v1.9.x  nodebb
cd nodebb

Finally run the setup.

./nodebb setup

After a moment,  you should see a message that the setup is done.

Welcome to NodeBB v1.9.3!

This looks like a new installation, so you'll have to answer a few questions about your environment before we can proceed.
Press enter to accept the default setting (shown in brackets).
URL used to access this NodeBB ( 
Please enter a NodeBB secret (b5528104-4fbd-4560-9d6a-efd8fecf3069) 
Which database to use (mongo) 
2018-10-23T15:34:46.062Z [8359] - info: 
Now configuring mongo database:
MongoDB connection URI: (leave blank if you wish to specify host, port, username/password and database individually)
Format: mongodb://[username:password@]host1[:port1][,host2[:port2],.[,hostN[:portN]]][/[database][?options]] 
Host IP or address of your MongoDB instance (127.0.0.1) 
Host port of your MongoDB instance (27017) 
MongoDB username nodebbuser
Password of your MongoDB database 
MongoDB database name (nodebb) 
2018-10-23T15:35:32.123Z [8359] - info: [database] Checking database indices.
2018-10-23T15:35:32.217Z [8359] - info: [database] Checking database indices done!
Configuration Saved OK
Populating database with default configs, if not already set.
2018-10-23T15:35:34.174Z [8359] - warn: [cache-buster] could not read cache buster message=ENOENT: no such file or directory, open '/home/richard/nodebb/build/cache-buster', stack=Error: ENOENT: no such file or directory, open '/home/richard/nodebb/build/cache-buster', errno=-2, code=ENOENT, syscall=open, path=/home/richard/nodebb/build/cache-buster
Enabling default theme: nodebb-theme-persona
No categories found, populating instance with default categories
2018-10-23T15:35:35.491Z [8359] - warn: No administrators have been detected, running initial user setup

Administrator username admin
Administrator email address [email protected]
Password 
Confirm Password 
Creating welcome post!
Enabling default plugins

After setting up, run the commands below to start it.

./nodebb start

Now open your browser and browse to the server hostname or IP address followed by port # 4567

You should see NodeBB Forum page.

Logon to the backend using the admin account you created above.

/admin

NodeBB Forurm Ubuntu install

That’s it!

You may also like the post below: