How to Install NodeBB on Ubuntu 14.04

An updated version of this tutorial available at installation of nodeBB on ubuntu 16.04. I recommend you follow that.

NodeBB is a modern style forum software built on latest technologies like NodeJS, Redis and MongoDB. So you will not be able to install it on common cPanel based shared hosting. You will need a VPS or Dedicated server of your own to install it. If you haven’t already got an server I suggest you go to digitalocean(use this link to signup and you will get $10 to test with) and create a VPS.

In this series:

For this tutorial I am starting with a digitalocean 1 GB RAM server at New york.

Here are the steps:

Install LTS version of Node.js using these command:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

Above command will add nodejs repository.

Install nodejs by executing this command:

apt-get install nodejs

Install MongoDB database server

Install MongoDB server by issuing this command:

sudo apt-get install -y git nodejs mongodb build-essential

Install NodeBB

You can Install nodeBB anywhere you like. Here we will make a directory in /var/www/ :

mkdir /var/www

Now cd into that directory:

cd /var/www

Clone nodeBB in this directory by this command:

git clone -b v1.9.3 https://github.com/NodeBB/NodeBB.git nodebb

replace v1.9.3 with the latest version listed here. Above command will clone the nodebb files in ‘nodebb’ directory. Install all the nodeBB dependencies by this command:

cd nodebb
npm install --production

Start nodeBB web Installer:

npm start

Open the web Installer by going to http://yourip:4567 or http://example.com:4567. For example if you are installing it on local machine your address will be http://127.0.0.1:4567.

Finish the web Installation

When you visit the proper address as shown above you will be presented with web interface with 2 sections. First section is for forum admins credentials. NodeBB admin data And second section is for database configuration: nodeBB database credentials Enter you Administrator details in first section. In the second section select MongoDB from dropdown menu and leave other fields as it is and press ‘Install NodeBB’ button. I will install NodeBB and tell you when finished. Start your forum by issuing this command:

./nodebb start

Now you can see your website live on the same address i.e. http://yourip:4567 or http://example.com:4567.

By default nodeBB runs on port 4567 and it is generally advised that you should not run nodejs apps on port 80 as it is a security risk.

To get nodeBB running on port 80 or in normal language running it on http://example.com you need to setup nginx as your web proxy.

Configuring nginx

nodeBB requires nginx v1.3.13 or greater. Install nginx using this command:

apt-get install nginx

check your nginx version:

nginx -V

nginx served sites are contained in a server block. Add your server block in nginx configuration file by using this command:

nano /etc/nginx/sites-available/default

paste below server block at the top

  
 server {
    listen 80;
    server_name forum.example.org;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        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";
    }
}

Change the server_name from ‘forum.example.org‘ to your domain name or your ip address. it should look like this: nodeBB nginx configuration Now restart the nginx server:

service nginx restart

Now check your website at http://example.com or http://yourip. nodeBB home page Configure and enjoy!

Next in series: