• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Debian

How to Install NodeBB forum on Debian 9

How VPS by How VPS
November 1, 2019
in Debian
0
0
SHARES
36
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Using a Different System?
  2. Requirements
  3. Before you begin
  4. Install Node.js
  5. Install and configure MongoDB
  6. Install and configure Nginx
  7. Install Acme.sh client and obtain a Let’s Encrypt certificate (optional)
  8. Install NodeBB
  9. Run NodeBB as a System Service
  10. Want to contribute?

Using a Different System?

  • How to Install NodeBB Forum on Ubuntu 18.04 LTS

  • How to Install NodeBB forum on Fedora 28

  • How to Install NodeBB forum on FreeBSD 12

Are we missing a guide for your target system? Request one, or submit your own!


NodeBB is a Node.js based forum. It utilizes web sockets for instant interactions and real-time notifications. NodeBB source code is publicly hosted on Github. This guide will walk you through the NodeBB installation process on a fresh Debian 9 Vultr instance using Node.js, MongoDB as a database, Nginx as a reverse proxy and Acme.sh for SSL certificates.

Requirements

NodeBB requires the following software to be installed:

  • Git
  • Node.js version 6.9.0 or later
  • MongoDB version 2.6 or later
  • Nginx
  • Minimum of 1024MB RAM
  • Domain name with A/AAAA records set up

Before you begin

Check the Debian version.

lsb_release -ds
# Debian GNU/Linux 9.4 (stretch)

Ensure that your system is up to date.

apt update && apt upgrade -y

Install necessary packages.

apt install -y sudo dirmngr git build-essential apt-transport-https

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Install Node.js

NodeBB is driven by Node.js, and so it needs to be installed. The installation of the current LTS version of Node.js is recommended.

Install Node.js from the NodeSource repository.

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs

Verify installation of Node.js and npm.

node -v && npm -v
# v10.15.0
# 5.6.0

Install and configure MongoDB

MongoDB is the default database for NodeBB.

Install MongoDB from the official MongoDB repository.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb https://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt update
sudo apt install -y mongodb-org

Check the version.

mongo --version | head -n 1 && mongod --version | head -n 1
# MongoDB shell version v4.00
# db version v4.0.0

Start and enable MongoDB.

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

Create a MongoDB database and user for NodeBB.

Connect to MongoDB.

mongo

Switch to the built-in admin database.

> use admin

Create an administrative user.

> db.createUser( { user: "admin", pwd: "<Enter a secure password>", roles: [ { role: "readWriteAnyDatabase", db: "admin" }, { role: "userAdminAnyDatabase", db: "admin" } ] } )

NOTE: Replace the placeholder <Enter a secure password> with your own selected password.

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" } ] } )

NOTE: Again, replace the placeholder <Enter a secure password> with your own selected password.

Exit the Mongo shell.

> quit()

Restart MongoDB and verify that the administrative user created earlier can connect.

sudo systemctl restart mongod.service
mongo -u admin -p your_password --authenticationDatabase=admin

Install and configure Nginx

Install the latest mainline version of Nginx from the official Nginx repository.

wget https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
rm nginx_signing.key
sudo -s
printf "deb https://nginx.org/packages/mainline/debian/ $(lsb_release -sc) nginx/ndeb-src https://nginx.org/packages/mainline/debian/ $(lsb_release -sc) nginx/n" >> /etc/apt/sources.list.d/nginx_mainline.list
exit
sudo apt update
sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.15.0

Enable and start Nginx.

sudo systemctl enable nginx.service
sudo systemctl start nginx.service

NodeBB, by default, runs on port 4567. To avoid typing http://example.com:4567, we will configure Nginx as a reverse proxy for the NodeBB application. Every request on port 80 or 443 (if SSL is used) will be forwarded to port 4567.

Run sudo vim /etc/nginx/conf.d/nodebb.conf and populate it with the basic reverse proxy configuration shown below.

server {

  listen [::]:80;
  listen 80;

  server_name forum.example.com;

  root /usr/share/nginx/html;

  client_max_body_size 50M;

  location /.well-known/acme-challenge/ {
    allow all;
  }

  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_hide_header X-Powered-By;
    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";
  }

}

In the config above, update the server_name directive with your domain/hostname.

Check the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install Acme.sh client and obtain a Let’s Encrypt certificate (optional)

Securing your forum with HTTPS is not necessary, but it will secure your site’s traffic. Acme.sh is a pure Unix shell software for obtaining SSL certificates from Let’s Encrypt with zero dependencies.

Download and install Acme.sh.

sudo mkdir /etc/letsencrypt
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
sudo ./acme.sh --install --home /etc/letsencrypt --accountemail [email protected]
cd ~
source ~/.bashrc

Check the version.

acme.sh --version
# v2.7.9

Obtain RSA and ECDSA certificates for forum.example.com.

# RSA 2048
sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt -d forum.example.com --webroot /usr/share/nginx/html --reloadcmd "sudo systemctl reload nginx.service" --accountemail [email protected] --ocsp-must-staple --keylength 2048
# ECDSA/ECC P-256
sudo /etc/letsencrypt/acme.sh --issue --home /etc/letsencrypt -d forum.example.com --webroot /usr/share/nginx/html --reloadcmd "sudo systemctl reload nginx.service" --accountemail [email protected] --ocsp-must-staple --keylength ec-256

After running the above commands, your certificates and keys will be in the following directories:

  • RSA: /etc/letsencrypt/forum.example.com
  • ECC/ECDSA: /etc/letsencrypt/forum.example.com_ecc

After obtaining certificates from Let’s Encrypt, we need to configure Nginx to use them.

Run sudo vim /etc/nginx/conf.d/nodebb.conf again and configure Nginx as an HTTPS reverse proxy.

server {

  listen [::]:443 ssl http2;
  listen 443 ssl http2;
  listen [::]:80;
  listen 80;

  server_name forum.example.com;

  root /usr/share/nginx/html;

  client_max_body_size 50M;

  location /.well-known/acme-challenge/ {
    allow all;
  }

  # RSA
  ssl_certificate /etc/letsencrypt/forum.example.com/fullchain.cer;
  ssl_certificate_key /etc/letsencrypt/forum.example.com/forum.example.com.key;
  # ECDSA
  ssl_certificate /etc/letsencrypt/forum.example.com_ecc/fullchain.cer;
  ssl_certificate_key /etc/letsencrypt/forum.example.com_ecc/forum.example.com.key;

  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";
  }

}

Check the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install NodeBB

Create a document root directory.

sudo mkdir -p /var/www/nodebb

Change ownership of the /var/www/nodebb directory to johndoe.

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

Navigate to the document root folder.

cd /var/www/nodebb

Clone the latest NodeBB into document root folder.

git clone -b v1.10.x https://github.com/NodeBB/NodeBB.git .

Run the NodeBB setup command and answer each question when prompted.

./nodebb setup

After NodeBB setup is completed, run ./nodebb start to manually start your NodeBB server.

./nodebb start

After this command, you will be able to access your forum in your web browser.

Run NodeBB as a System Service

When started via ./nodebb start, NodeBB will not automatically start up again when the system reboots. To avoid that, we will need to setup NodeBB as a system service.

If running, stop NodeBB.

./nodebb stop

Create a new nodebb user:

sudo adduser nodebb

Change the ownership of the /var/www/nodebb directory to nodebb.

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

Create a nodebb.service systemd unit config file. This unit file will handle startup of NodeBB deamon. Run sudo vim /etc/systemd/system/nodebb.service and populate the file with the following content:

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

[Service]
Type=forking
User=nodebb

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=nodebb

Environment=NODE_ENV=production
WorkingDirectory=/var/www/nodebb
PIDFile=/var/www/nodebb/pidfile
ExecStart=/usr/bin/env node loader.js
Restart=always

[Install]
WantedBy=multi-user.target

NOTE: Set username and directory paths according to your chosen names.

Enable nodebb.service on reboot and immediately start nodebb.service.

sudo systemctl enable nodebb.service
sudo systemctl start nodebb.service

Check the nodebb.service status.

sudo systemctl status nodebb.service
sudo systemctl is-enabled nodebb.service

That’s it. Your NodeBB instance is now up and running.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install Gitea on Debian 9

Next Post

Upgrading Debian 9 to Debian 10

Next Post

Upgrading Debian 9 to Debian 10

Leave a Reply Cancel reply

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

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet