Install and Setup NodeBB with Redis and Nginx on Ubuntu 12.04


nodebbIn the following post we will show you how to install and configure NodeBB on an Ubuntu VPS. NodeBB is a modern and open-source Forum Software powered by Node.js . It is a powerful discussion platform offering one-click plugin install, social network connectivity and responsive design.

 

Login to your server using SSH

ssh username@hostname

Update the system and install all the necessary packages.

~ # ❯❯❯ sudo apt-get -y update && apt-get -y upgrade
~ # ❯❯❯ sudo apt-get -y install python-software-properties git sed supervisor

Install the latest version of Nodejs

~ # ❯❯❯ sudo add-apt-repository ppa:chris-lea/node.js
~ # ❯❯❯ sudo apt-get update && sudo apt-get install nodejs

Install the the latest version of Redis

~ # ❯❯❯ sudo add-apt-repository -y ppa:rwky/redis
~ # ❯❯❯ sudo apt-get update && sudo apt-get install -y redis-server

Pull down the latest NodeBB code

~ # ❯❯❯ mkdir ~/myNodebbApp && cd $_
~ # ❯❯❯ git clone https://github.com/designcreateplay/NodeBB.git . # do not forget the dot at the end

Configure NodeBB

Install all NodeBB’s dependencies

 # ❯❯❯ npm install

Type the following, while in the NodeBB root directory:

~ # ❯❯❯ node app --setup='{ 
    "base_url": "http://yourAppUrl.com",
    "admin:username": "adminUsername", 
    "admin:password": "adminPassword", 
    "admin:password:confirm": "adminPassword",
    "admin:email": "your@email.com"
}'

Using Nginx as a proxy for NodeBB

Install and Configure the the latest version of Nginx

~ # ❯❯❯ sudo add-apt-repository -y ppa:nginx/stable
~ # ❯❯❯ sudo apt-get update
~ # ❯❯❯ sudo apt-get install -y nginx

Set the worker_processes to the number of processors in your system. To find out the number of processors in your system and set the worker_processes, run the following command:

~ # ❯❯❯ sudo sed -i "0,/^worker_processes/ s/^worker_processes .*$/worker_processes `grep -c processor /proc/cpuinfo`;/"  /etc/nginx/nginx.conf

Create a new nginx virtual host

~ # ❯❯❯ sudo vim /etc/nginx/sites-available/yourAppUrl.com
server {
    listen       80;
    server_name  yourAppUrl.com;
    location / {
        proxy_pass        http://localhost:4567/;

        proxy_set_header Host $host;
        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_redirect off;
        proxy_buffering   off;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
~ # ❯❯❯ sudo ln -s /etc/nginx/sites-available/yourAppUrl.com /etc/nginx/sites-enabled/yourAppUrl.com
~ # ❯❯❯ sudo /etc/init.d/nginx restart

That’s it. Now open your browser and navigate to your domain.

For more info about NodeBB please go to: https://nodebb.org


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Tutorials
How to Install Subrion CMS on a Debian 8 VPS
Tutorials
Install and configure Jenkins with Nginx as a reverse proxy on CentOS 7
Tutorials
Install and run WordPress cached with Redis on a Linux VPS
  • Julian Lam

    Thanks for the write-up! Please note that you don’t need root privileges when you run “npm install” to install our dependent packages :)


    • admin

      adminadmin

      Author Reply

      Thanks for pointing out. Fixed.


  • Tung

    TungTung

    Author Reply

    You save my half-day :D Thank you


  • Julian Lam

    Also, the command “sudo apt-get vim /etc/nginx/sites-available/yourAppUrl.com” needs to be revised. The “apt-get” is not supposed to be there. A note should also be put in to say that “yourAppUrl.com” should probably be replaced with something else (though it will still work with that placeholder.


  • Roldan

    RoldanRoldan

    Author Reply

    With all the articles I read.
    This is the best Tutorial for NodeBB Installation, Thanks a lot!
    Better than nodebb doc site.


  • David Sowsy

    Hi there, I’m interested in your NodeBB setup. I’ve been testing out NodeBB for a technology demo for a client of mine and have had redis die several times and get the whole site hosed without a backup. Can your managed service do backups and restore of the redis database? it’s a critical thing to get this backed up and up quickly so we can do demos. What is your NodeBB backup process?

    Thanks!


  • admin

    adminadmin

    Author Reply

    Hi, thanks for your interest in our services. All our virtual servers are backed up once weekly. The backup is mounted on the server, allowing you to access your backup data if you need to restore some files/directories.

    We can also set up a custom cron job to make scheduled local backups of your Redis DB.

    For more detailed information, please contact us via live chat or email us at helpdesk@rosehosting.com

    Thanks.


  • a

    aa

    Author Reply

    proxy_set_header Connection “upgrade”
    there is a semi-colon at the end!