📋
SaveYourTime
  • SaveYourTime - Coding Notes
  • Front-End
    • Next.js - Set up with TypeScript
  • Backend
    • Install MySQL on Ubuntu
    • Setup Certbot with route53 on Ubuntu 20.04
    • Configure a Nginx HTTPS Reverse Proxy
    • TypeORM - How to seed data with typeorm-seeding 🔥
  • React Native
    • React Native - Facebook Login
    • React Native - Adding a new Swift file and a Bridge header
  • Tools
    • ESLint
    • Prettier
  • Amazon Web Services
    • AWS - Deploy Next.js Application to AWS S3
    • AWS - Deploy Nest.js Server to Elastic Beanstalk
    • AWS - Setup AWS CloudFront
    • AWS - Configure HTTPS for CloudFront with GoDaddy Domain
    • AWS - Configure HTTPS for Elastic Beanstalk Environments with GoDaddy Domain
    • AWS - Fix Next.js static site hosted on S3 CloudFront routing fails on page reload
    • AWS - Running Puppeteer on AWS EC2
    • AWS - Running Metabase on AWS Elastic Beanstalk
  • GitHub Actions
    • Github - Deploying a React Next.js App to AWS S3 with Github Actions
    • Github - Deploying a Nest.js App to AWS Elastic Beanstalk (Docker Platform) with Github Actions
    • Github - Deploying a Nest.js App to AWS Elastic Beanstalk (Node.js Platform) with Github Actions
  • Others
    • Using Fastlane to automate beta deployments and releases for your iOS and Android apps
    • NodeBB
Powered by GitBook
On this page
  • Installing Node.js
  • Install NVM
  • Install Node.js
  • Test Node.js
  • Installing MongoDB
  • Import the public key used by the package management system.
  • Create a list file for MongoDB
  • Reload local package database
  • Install the MongoDB packages
  • Verify installation of MongoDB
  • Start MongoDB
  • Verify that MongoDB has started successfully
  • Configure MongoDB
  • Create an administrative user:
  • Create the nodebb user with the appropriate privileges:
  • Enable database authorization in the MongoDB configuration file
  • Installing NodeBB
  • Installing Nginx
  • Configuring Nginx

Was this helpful?

  1. Others

NodeBB

https://docs.nodebb.org/installing/os/ubuntu/

PreviousUsing Fastlane to automate beta deployments and releases for your iOS and Android apps

Last updated 4 years ago

Was this helpful?

Installing Node.js

Install NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

Install Node.js

nvm install node

Test Node.js

nvm -v
node -v
npm -v

node -e "console.log('Running Node.js ' + process.version)"

Installing MongoDB

Import the public key used by the package management system.

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

Create a list file for MongoDB

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

Reload local package database

sudo apt-get update

Install the MongoDB packages

sudo apt-get install -y mongodb-org

Verify installation of MongoDB

mongod --version

Start MongoDB

sudo systemctl start mongod

Verify that MongoDB has started successfully

sudo systemctl status mongod

You can optionally ensure that MongoDB will start following a system reboot

sudo systemctl enable mongod

Configure 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: "root", db: "admin" } ] } )

This user is scoped to the admin database to manage MongoDB once authorization has been enabled.

Add a new database called nodebb:

use nodebb

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

Exit the Mongo Shell:

quit()

Enable database authorization in the MongoDB configuration file

/etc/mongod.conf
security:
  authorization: enabled

Restart MongoDB and verify the administrative user created earlier can connect:

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

Installing NodeBB

First, we must install git as it is used to distribute NodeBB:

sudo apt-get install -y git
git clone -b v1.16.x https://github.com/NodeBB/NodeBB.git nodebb
cd nodebb
./nodebb setup
./nodebb start

Installing Nginx

NodeBB by default runs on port 4567, meaning that by default you must access it using a port number in addition to the hostname (e.g. http://example.org:4567)

In order to allow NodeBB to be served without a port, Nginx can be set up to proxy all requests to a particular hostname (or subdomain) to an upstream NodeBB server running on any port.

sudo apt-get install -y nginx

Verify the installation of Nginx

nginx -v

Run Nginx

sudo systemctl start nginx
sudo systemctl status nginx

Configuring Nginx

NGINX-served sites are contained in a server block which are normally stored in separate files from the main Nginx config (which is very rarely edited).

When installing with the ppa above, the best way to install new Nginx configs is to add new files in /etc/nginx/sites-available (like /etc/nginx/sites-available/forum.example.org). You then must link these files from sites-available to sites-enabled.

The following demonstrates a typical series of commands when creating a new nginx config:

cd /etc/nginx/sites-available
sudo vim forum.example.com # config entered into file and saved
/etc/nginx/sites-available/forum.example.com
server {
    listen 80;

    server_name forum.example.com;

    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";
    }
}
cd ../sites-enabled
sudo ln -s ../sites-available/forum.example.com
sudo systemctl reload nginx
Ubuntu (Recommended) - NodeBB Documentation
Tutorial: Setting Up Node.js on an Amazon EC2 Instance - AWS SDK for JavaScriptAWS SDK for JavaScript
Logo
GitHub - nvm-sh/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versionsGitHub
Install MongoDB Community Edition on Ubuntumongodb
Logo
Releases · NodeBB/NodeBBGitHub
Logo
Logo
Logo