Install NodeBB on DigitalOcean Cloud in 5 minutes

Install NodeBB on DigitalOcean Cloud in 5 minutes
đź’ˇ
This article has been marked for review! The same may be updated by January 31st, 2025.

In this tutorial we will install NodeBB on DigitalOcean cloud in just 5 minutes. The reason behind is their ability to handle real-time communication with minimal effort and resources. JavaScript is, however, not my expertise but hey we do not need to learn about JavaScript. We will simply install NodeBB on DigitalOcean.

How to Install NodeBB on DigitalOcean

There are already some good article written about installing NodeBB on different environments. One of the easiest was from Andrew Rodrigues, co-founder of NodeBB, itself. But that seems to be old and there are many points which should be updated now. I will extend that article more or less. Feel free to inform me if anything needs attention.

Disclaimer: That’s a referral link. But if you sign up DigitalOcean using my link then you will also get $200 credit. This credit will be enough for 2 months hosting.

Let’s install NodeBB in 5 Minutes

NodeBB, a forum software for instant interaction and real-time notifications, runs on server-side JavaScript program called NodeJS. The beauty of NodeJS is to handle thousands of concurrent users with a single process. It is incredibly fast but might be totally new for many.

We although may install NodeBB on tiniest DigitalOcean server with 512Mb RAM. But, I would highly recommend a 1 GB droplet, since the RAM will become a bottleneck to overall performance. If you can't spend 2 bucks more for a 1 GB VPS on DO Cloud, then I would suggest you to start with the 512 Mb and temporarily allocate more ram, may be for a day, until you install, configure your forum.

Install Dependencies and Prerequisites for NodeBB

Open a fresh PuTTY terminal and login with the user id bill (or yours, if you have created something else) and run the following command:

sudo apt update && sudo apt full-upgrade

It will update the packages but take about a minute to complete. After completion run the following command various software and dependencies including git, nodejs, npm, ~~redis-server ~~ MongoDB and nginx.

sudo apt-get install -y git nginx build-essential imagemagick ca-certificates curl gnupg

Install NodeBB on DigitalOcean

Now we have completed installing all the dependencies for NodeBB. So it’s time to install NodeBB but first create a directory for it. In the tutorial we will install our forum in a dedicated directory called forums. You may change it to what so ever to identify easily.

sudo mkdir -p /var/www/nodebb/

And Then

cd /var/www

Now, the prompt will be like this: bill@alpha:/var/www$. It’s time to change the ownership of the directory to bill.

sudo chown -R bill:bill nodebb

If you have some other user name created change it accordingly. Now run

cd nodebb

It’s time clone NodeBB to the forums directory with following command

git clone git://github.com/NodeBB/NodeBB.git forums

Run the script and install Node.js.

curl -fsSL https://deb.nodesource.com/setup_lts.x -o nodesource_setup.sh

sudo -E bash nodesource_setup.sh
sudo apt-get install -y nodejs

Now move to the directory forums and install NodeBB. To do so run the following commands one by one:

Install Mongodb

curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
   --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org

Check out this link to know about creating a Mongo DB database and user

cd nodebb

./nodebb setup

In the following command you will be asked for NodeBB configuration. Here we will only have to configure ip address and rest should be left blank. The IP address is same as your server ip, configure accordingly. The setup is like this. Later you will be asked for a Admin account, enter your desired login id and password to log into forum. Run

This time everything should be fine and we have successfully installed NodeBB on DigitalOcean. Your forum will be available on http://<droplet-ip=address>:4567

As you have seen it it really easy to install NodeBB on DigitalOcean droplet we will configure Nginx to act as NodeBB Proxy in the next post.