
This article provides a guide demonstrating how to easily deploy NodeBB community forum on Ubuntu VPS server.
What is NodeBB?

NodeBB is an open-source forum software platform built with Node.js. The forum offers modern, scalable, and responsive experiences. Here are some key features and characteristics of NodeBB:
- Real-Time Updates: With support for WebSockets, NodeBB allows real-time interactions with live-update functionalities and notifications without having to refresh the page.
- Plugin System: It comes with a flexible plugin architecture. Developers can extend functionality with a wide range of plugins provided for all kinds of purposes: social media integration, gamification, and much more.
- Responsive Design: NodeBB is built with a responsive design to extend a wonderful user experience not only in desktops but also in other mobile devices.
- Scalability: Built over Node.js, it is able to handle heavy loads, hence well-suited for large-sized communities.
- Customization: A wide array of customization features, from themes to templates, lets users entirely make the looks and feels of the forum fit their own needs and branding.
- User Management: User management of NodeBB is well done; one can easily control permissions and user access.
- SEO-friendly: How the forum has been created is just perfect for SEOβa high ranking in search engines.
- Open Source: As an open-source platform, NodeBB can be looked into and altered by developers who wish to contribute to modifying the code. NodeBB is often chosen for communities and businesses looking for a modern, feature-rich forum platform that is equally flexible and performant.
How to Easily Deploy NodeBB Community Forum on Ubuntu VPS
This installation guide is optimized for Ubuntu 24.04 LTS and will install NodeBB with MongoDB as the database. Fully patched LTS and equivalentΒ productionΒ versions of software are assumed and used throughout.
System Requirements
- Memory: Installing NodeBBβs dependencies may require more than 512 MB of system memory. It is recommended to enable a swap partitionΒ to compensate if your Linux system has insufficient memory.
Installing Node.js
Naturally, NodeBB is driven by Node.js, and so it needs to be installed. Node.js is a rapidly evolving platform and so installation of the current LTS version of Node.js is recommended to make future updates seamless. TheΒ Node.js LTS PlanΒ details the LTS release schedule including projected end-of-life.
Node.js is available from the NodeSource Ubuntu binary distributions repository.
- Download and import the Nodesource GPG key
sudo apt update sudo apt install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
- Create deb repository
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_lts.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
- Run Update and Install
sudo apt update sudo apt install nodejs npm -y
Verify installation of Node.js and npm. You should have version lts of Node.js installed, and version 10 of npm installed:
node -v npm -v (should output "10.2.3" or similar)
Database
Installing MongoDB
MongoDB is the default database for NodeBB. As noted in theΒ MongoDB Support PolicyΒ versions older thanΒ 4.0Β are officiallyΒ End of LifeΒ as of October 2021. This guide assumes installation ofΒ 8.0. If you wish to use another database instead of MongoDB theΒ Configuring DatabasesΒ section has more information.
Official detailed installation instructions can be found in theΒ MongoDB manual. Although out of scope for this guide, some MongoDB production deployments leverage clustering, sharding and replication for high availability and performance reasons. Please refer to the MongoDB ReplicationΒ andΒ ShardingΒ topics for further reading. Keep in mind that NodeBB does not require any of these advanced configurations, and doing so may complicate your installation. Keeping it simple often can be best.
The following is an abbreviation of the officialΒ MongoDB installation guide for Ubuntu. If youβre having issues, fall back to using that guide instead.
sudo apt install gnupg curl -y curl -fsSL https://pgp.mongodb.com/server-8.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ --dearmor echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list sudo apt update sudo apt install -y mongodb-org
Verify installation of MongoDB. You should have version 8.0:
mongod --version db version v8.0
Start theΒ mongodΒ service and verify service status:
sudo systemctl start mongod sudo systemctl status mongod
Configure MongoDB
General MongoDB administration is done through the MongoDB ShellΒ mongo. A default installation of MongoDB listens on portΒ 27017Β and is accessible locally. Access the shell:
mongosh
Switch to the built-inΒ adminΒ database:
> use admin
Create an administrative user (the is different from theΒ nodebbΒ user weβll create later). Replace the placeholderΒ <Enter a secure password>Β with your own selected password. Be sure that theΒ <Β andΒ >Β are also not left behind.
> db.createUser( { user: "admin", pwd: "<Enter a secure password>", roles: [ { role: "root", db: "admin" } ] } )
This user is scoped to theΒ adminΒ database to manage MongoDB once authorization has been enabled.
To initially create a database that doesnβt exist simplyΒ useΒ it. Add a new database calledΒ nodebb:
> use nodebb
The database will be created and context switched toΒ nodebb. Next create theΒ nodebbΒ user with the appropriate privileges:
> db.createUser( { user: "nodebb", pwd: "<Enter a secure password>", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )
TheΒ readWriteΒ permission allows NodeBB to store and retrieve data from theΒ nodebbΒ database. TheΒ clusterMonitorΒ permission provides NodeBB read-only access to query database server statistics which are then exposed in the NodeBB Administrative Control Panel (ACP).
Exit the Mongo Shell:
> quit()
Enable database authorization in the MongoDB configuration fileΒ /etc/mongod.confΒ by appending the following lines:
security: authorization: enabled
Restart MongoDB and verify the administrative user created earlier can connect:
sudo systemctl restart mongod
To connect to a MongoDB deployment that requires authentication, use theΒ --usernameΒ andΒ --authenticationDatabaseΒ options. mongosh prompts you for a password, which it hides as you type.
mongosh "mongodb://hostname:port" --username admin --authenticationDatabase admin
If everything is configured correctly the Mongo Shell will connect. Exit the shell.
Installing NodeBB
First, we must installΒ gitΒ as it is used to distribute NodeBB:
sudo apt install -y git
gitΒ andΒ ./nodebbΒ shouldΒ notΒ be used with root access (sudoΒ or elevated privileges). It will cause problems with different ownership of files NodeBB needs access to.Next, clone NodeBB into an appropriate location. Here the localΒ nodebbΒ directory is used, though any destination is fine:
git clone -b v3.x https://github.com/NodeBB/NodeBB.git nodebb cd nodebb
This clones the NodeBB repository from theΒ v3.xΒ branch to theΒ nodebbΒ directory. A list of alternative branches are available in theΒ NodeBB BranchesΒ GitHub page, but only the versioned branches are stable.
NodeBB ships with a command line utility which allows for several functions. Weβll first use it to setup NodeBB. This will install modules fromΒ npm and then enter the setup utility.
./nodebb setup
A series of questions will be prompted with defaults in parentheses. The default settings are for a local server listening on the default portΒ 4567Β with a MongoDB instance listening on portΒ 27017. When prompted for the mongodb username and password, enterΒ nodebb, and the password that you configured earlier. Once connectivity to the database is confirmed the setup will prompt that initial user setup is running. Since this is a fresh NodeBB install a forum administrator must be configured. Enter the desired administrator information. This will culminate in aΒ NodeBB Setup CompletedΒ message.
Note: When entering your site URL, make sure it isΒ exactlyΒ what you plan on accessing your site at. If you plan on visitingΒ http://forum.example.comΒ to open your forum, then enter exactlyΒ http://forum.example.com.
A configuration fileΒ config.jsonΒ will be created in the root of the nodebb directory. This file can be modified should you need to make changes such as changing the database location or credentials used to access the database.
Finally, you can use the cli utility to start NodeBB:
./nodebb start
Installing nginx
NodeBB by default runs on portΒ 4567, meaning that by default you must access it using a port number in addition to the hostname (e.g.Β http://example.org:4567)
In order to allow NodeBB to be served without a port, nginx can be set up to proxy all requests to a particular hostname (or subdomain) to an upstream NodeBB server running on any port.
sudo apt install -y nginx
Verify the installation of nginx:
nginx -v
Verify that the service will run:
sudo systemctl start nginx sudo systemctl status nginx
You should now be able to go to your siteβs address in your browser and see the defaultΒ Welcome to nginx!Β message.
Configuring nginx
NGINX-served sites are contained in aΒ serverΒ block which are normally stored in separate files from the main nginx config (which is very rarely edited).
When installing with the ppa above, the best way to install new nginx configs is to add new files inΒ /etc/nginx/sites-availableΒ (likeΒ /etc/nginx/sites-available/forum.example.org). You then must link these files fromΒ sites-availableΒ toΒ sites-enabled.
The following demonstrates a typical series of commands when creating a new nginx config:
cd /etc/nginx/sites-available sudo nano forum.example.com # config entered into file and saved cd ../sites-enabled sudo ln -s ../sites-available/forum.example.com
Below is an example configuration for NodeBB running on portΒ 4567.
server {
listen 80;
server_name forum.example.com;
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_pass http://127.0.0.1:4567;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
After making changes to nginx configs, you have to reload the service for changes to take effect:
sudo systemctl reload nginx
For more information, go to theΒ configuring nginxΒ page.
Set up HTTPS using Letβs Encrypt for secure connections:
apt install certbot python3-certbot-nginx -y certbot --nginx -d forum.example.com
After Installation
Great, you have NodeBB installed and running.
Login and access the NodeBB administrative portal from: https://forum.example.com/admin using the credentials created during the NodeBB setup.
Conclusion
You now know how to easily install NodeBB community forum on Ubuntu VPS. Cheers to your new self-hosted community discussion board, powered by NodeBB and Ubuntu VPS!










