How to Install NodeBB on CentOS 7

NodeBB is a modern, open source, and NodeJS-based forum software.

With customers in mind, NodeBB offers community owners powerful features and ease of use to drive community engagement.

In this article, we will be installing NodeBB on CentOS 7.


  • A newly deployed Vultr CentOS 7 x64 server instance at least 1 GB RAM.
  • Logging in as the root user.
  • The EPEL yum repository.

Step 1: Update the system

Log in to your server via SSH using the sudo user to install epel, update the system, and restart to apply the updates.

yum install epel-release -yyum update -y && sudo shutdown -r now

Step 2: Install dependencies for NodeBB

Next, we will install all the NodeBB required system dependancies:

yum -y groupinstall "Development Tools"yum -y install git redis ImageMagick npm

Start redis and make it run at each and every system startup:

systemctl start redis.servicesystemctl enable redis.service

Step 3: Install NodeJS using nvm

Use the following commands to install NodeJS v6.9.5—the latest LTS release of NodeJS at the time this article was written.

Note: The second command below will invoke nvm v0.33.0, the latest release of nvm at the time of writing this article. You can always check out the latest release of nvm here and then modify that command accordingly.

cdcurl -o- | bashsource ~/.bash_profilenvm list-remotenvm install v6.9.5

Step 4: Install NodeBB

Install the latest release of NodeBB, NodeBB v1.4.3, as follows:

cd /optgit clone -b v1.4.3 nodebbcd nodebbnpm install

After the installation, run the ./nodebb script with the setup flag in order to setup NodeBB:

./nodebb setup

Answer a few questions as follows in order to use the default settings with a redis database. When appropriate, press Enter to accept the default setting shown in brackets.

  • URL used to access this NodeBB (http://localhost:4567) <Enter>
  • Please enter a NodeBB secret (bb3244f1-3a7e-4ee2-bc77-5032fd4c8b00) <Enter>
  • Which database to use (mongo) redis
  • Host IP or address of your Redis instance ( <Enter>
  • Host port of your Redis instance (6379) <Enter>
  • Password of your Redis database <Enter>
  • Which database to use (0..n) (0) <Enter>
  • Administrator username admin
  • Administrator email address
  • Password yourpassword
  • Confirm Password yourpassword

Having NodeBB successfully installed and configured, you can manually start/stop/restart NodeBB by running:

./nodebb start./nodebb stop./nodebb restart

Step 5: Keep NodeBB running using forever

Forever is a tool which can keep nodejs-based app running. In production, this is a useful feature.

First, you need to stop NodeBB:

./nodebb stop

Install forever globally:

npm install forever -g

Start NodeBB using forever:

cd /opt/nodebbforever start app.js

You can confirm that NodeBB is running using a curl command:

curl -I http://localhost:4567

The output should resemble:

HTTP/1.1 200 OKX-Powered-By: NodeBBX-Frame-Options: SAMEORIGINAccess-Control-Allow-Origin: nullContent-Type: text/html; charset=utf-8Content-Length: 19845ETag: W/"4d85-cXlw1a5DyxHkfjSEd7Ru5Q"set-cookie: express.sid=s%3AqoIQ1-JSyw1tvrrhyXiP7Sm5D-gDJ9HT.Aum4qMXBPiCgZ7Il%2BtrePafZJWEt2dIJlS%2BBTRZjWZs; Path=/; Expires=Sun, 26 Feb 2017 15:14:35 GMT; HttpOnlyVary: Accept-EncodingDate: Sun, 12 Feb 2017 15:14:36 GMTConnection: keep-alive

Step 6: Setup an Nginx reverse proxy

Since NodeBB is running on localhost by default, you need to setup an Nginx reverse proxy in order to allow web access.

Install Nginx using YUM:

yum install nginx -y

Modify Nginx settings:

vi /etc/nginx/nginx.conf

Find the location / {} segment within the http {} segment:

http {    location / {    }}

Insert the below lines into the location / {} segment:

    proxy_pass;    proxy_http_version 1.1;    proxy_set_header X-Real-IP $remote_addr;    proxy_set_header Host $host;    proxy_set_header Upgrade $http_upgrade;    proxy_set_header Connection 'upgrade';    proxy_cache_bypass $http_upgrade;

The final result should be:

http {location / {    proxy_pass;    proxy_http_version 1.1;    proxy_set_header X-Real-IP $remote_addr;    proxy_set_header Host $host;    proxy_set_header Upgrade $http_upgrade;    proxy_set_header Connection 'upgrade';    proxy_cache_bypass $http_upgrade;}}

Save and quit:


Start and enable the Nginx service:

systemctl start nginx.servicesystemctl enable nginx.service

Step 7: Modify firewall rules in order to allow visitors’ access:

firewall-cmd --zone=public --permanent --add-service=httpfirewall-cmd --reload

Step 8: Access NodeBB

Finally, point your web browser to to visit the newly created NodeBB website. You can log in using the admin credentials you setup earlier. Feel free to navigate and customize NodeBB after logging in as the administrator.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.