Skip to content
Follow
CMS

How to install NodeBB forum on Ubuntu 24.04

Richard
Written by
Richard
Jun 21, 2024 Updated Mar 20, 2026 6 min read
NodeBB featured image
NodeBB featured image

You install NodeBB forum on Ubuntu 24.04 by setting it up with Nginx as a reverse proxy.

NodeBB is a powerful, modern forum software built on Node.js, designed for speed and customization. Using Nginx to proxy requests improves your NodeBB’s performance and security.

This setup lets Nginx handle crucial tasks like SSL encryption and efficient traffic management for your NodeBB forum, ensuring it runs smoothly.

⚡ Quick Answer

Install PostgreSQL, Node.js, and Git. Create a dedicated user and directory for NodeBB, then clone the NodeBB repository. Run `./nodebb setup` to configure the forum with your database and other settings.

Install PostgreSQL

To install PostgreSQL on Ubuntu 24.04, you’ll first need to add its GPG key to your system. This database is essential for storing all your NodeBB forum’s content.

Use the steps below to install it on Ubuntu.

First, add the PostgreSQL GPG key to Ubuntu. Run the command below to do that.

🐧Bash / Shell
sudo apt install curl
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /usr/share/keyrings/postgresql-key.gpg >/dev/null

Then, add the PostgreSQL APT repository to your sources list.

🐧Bash / Shell
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/postgresql-key.gpg arch=amd64] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Next, update and refresh the repository list and install PostgreSQL.

🐧Bash / Shell
sudo apt update
sudo apt install postgresql postgresql-contrib

More details on installing PostgreSQL can be found in the link below.

How to install PostgreSQL on Ubuntu

Configure PostgreSQL and create NodeBB database

After installing PostgreSQL, you need to configure it and create a specific database for your NodeBB forum. This involves logging into the PostgreSQL console and setting up the necessary user and database.

First, log on to the PostgreSQL console by running the command below.

🐧Bash / Shell
sudo -u postgres psql

Run the command below to change or create a password for the administrator account. Confirm the password when prompted.

💻Code
password postgres

Next, create a NodeBB database user account called ‘nodebbuser.’

💻Code
CREATE ROLE nodebbuser WITH LOGIN ENCRYPTED PASSWORD 'type_strong_password_here';

Replace ‘type_strong_password_here‘ with your password.

Next, create a ‘nodebbdb‘ database for NodeBB and make the user above owner.

💻Code
CREATE DATABASE nodebbdb OWNER nodebbuser;

Exit the database console.

💻Code
q

Install Node.js

The NodeBB forum is written using the Node.js framework. You’ll need a Node.js framework installed to run NodeBB.

Run the command below to install it.

💻Code
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install nodejs

Install Git

You will also need Git installed to use and configure NodeBB. Then, perform the initial configuration of Git by running the command below.

🐧Bash / Shell
sudo apt install git
git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"

Install NodeBB

With PostgreSQL ready, you can now install NodeBB on Ubuntu 24.04 by creating a dedicated user and directory for it. You’ll then download the NodeBB files to this new location.

🐧Bash / Shell
sudo adduser nodebb --disabled-password

Create a directory for NodeBB.

🐧Bash / Shell
sudo mkdir /var/www/html/nodebb -p
sudo chown -R nodebb:nodebb /var/www/html/nodebb

Next, switch to the NodeBB user account, navigate to the directory, and clone all the NodeBB files using Git.

🐧Bash / Shell
sudo su - nodebb
cd /var/www/html/nodebb

Clone NodeBB to the /var/www/nodebb directory. The dot at the end of the command refers to the current directory.

💻Code
git clone -b v2.x https://github.com/NodeBB/NodeBB.git .

NodeBB ships with a command-line utility. Use the following command to install NodeBB.

💻Code
./nodebb setup

Complete the prompts and wait for the installation to complete.

💻Code
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 (http://localhost:4567)
Please enter a NodeBB secret (ca8b716b-d793-4501-8db7-3a8a4f4f17ff)
Would you like to submit anonymous plugin usage to nbbpm? (yes)
Which database to use (mongo) postgres
2024-06-21T15:52:39.220Z [9899] - info:
Now configuring postgres database:
Host IP or address of your PostgreSQL instance (127.0.0.1)
Host port of your PostgreSQL instance (5432)
PostgreSQL username nodebbuser
Password of your PostgreSQL database
PostgreSQL database name (nodebb) nodebbdb
Enable SSL for PostgreSQL database access (false)
2024-06-21T15:53:21.697Z [9899] - info: [database] Checking database indices.
....................................................
Administrator username superadmin
Administrator email address superadmin@example.com
Password
Confirm Password
======================================================================

NodeBB Setup Completed. Run "./nodebb start" to manually start your NodeBB server.

Once everything is done, you can start NodeBB using the command below.

💻Code
./nodebb start

Then, open your browser and browse to the machine’s local host or IP address, followed by port number 4567.

💻Code
http://localhost:4567
NodeBB home portal
NodeBB home portal

Run NodeBB as a System Service

Running NodeBB as a system service on Ubuntu 24.04 makes it easier to manage, allowing you to start and stop it using the systemctl command. You’ll create a service file to define how NodeBB runs in the background.

First, stop the NodeBB service.

💻Code
./nodebb stop

Next, run the command below to create a NodeBB system service file.

🐧Bash / Shell
sudo nano /etc/systemd/system/nodebb.service

Copy and paste the lines below in the file and save it.

💻Code
[Unit]
Description=NodeBB
Documentation=https://docs.nodebb.org
After=system.slice multi-user.target postgresql.service

[Service]
Type=simple
User=nodebb

StandardError=syslog
SyslogIdentifier=nodebb

Environment=NODE_ENV=production
WorkingDirectory=/var/www/html/nodebb
ExecStart=/usr/bin/env node loader.js --no-silent --no-daemon
Restart=always

[Install]
WantedBy=multi-user.target

Enable and start NodeBB.

🐧Bash / Shell
sudo systemctl daemon-reload
sudo systemctl enable nodebb
sudo systemctl start nodebb
sudo systemctl status nodebb

The status option will display NodeBB as running and healthy.

💻Code
nodebb.service - NodeBB
Loaded: loaded (/etc/systemd/system/nodebb.service; enabled; preset: enabl>
Active: active (running) since Fri 2024-06-21 11:07:42 CDT; 7s ago
Docs: https://docs.nodebb.org
Main PID: 12269 (node)
Tasks: 22 (limit: 4561)
Memory: 146.5M (peak: 146.9M)
CPU: 2.324s
CGroup: /system.slice/nodebb.service
├─12269 node loader.js --no-silent --no-daemon
└─12280 /usr/bin/node /var/www/html/nodebb/app.js

Every time you start up the machine, NodeBB should be accessible using the local server name or IP address followed by the port number.

Set up a reverse proxy

To make your NodeBB forum accessible through a domain name and handle web traffic efficiently, you should set up a reverse proxy. This guide shows you how to set up a reverse proxy using either Nginx or Apache.

The two links below show you how to set up a reverse proxy using Nginx or Apache.

That should do it!

Conclusion:

  • Installing NodeBB with Nginx on Ubuntu 24.04 enhances web traffic handling and security.
  • PostgreSQL installation and configuration provide a solid foundation for the NodeBB database.
  • Node.js installation ensures the functionality of the NodeBB forum platform.
  • Git setup is essential for utilizing and configuring NodeBB efficiently
  • Creating NodeBB as a systemd service streamlines management and ensures its availability
  • Implementation of a reverse proxy further optimizes web traffic and accessibility for NodeBB

How do I install Node in Ubuntu?

Okay we can check the version of node now using node – v yeah here we can see 18.19. 1. It is installed and npm we can see.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04
How to Install NetData on Ubuntu 24.04
Ubuntu Linux How to Install NetData on Ubuntu 24.04
How to Install Emby Media Server on Ubuntu 24.04
Ubuntu Linux How to Install Emby Media Server on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *