NodeBB
https://docs.nodebb.org/installing/os/ubuntu/
Installing Node.js
Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bashInstall Node.js
nvm install nodeTest 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.listReload local package database
sudo apt-get updateInstall the MongoDB packages
sudo apt-get install -y mongodb-orgVerify installation of MongoDB
mongod --versionStart MongoDB
sudo systemctl start mongodVerify that MongoDB has started successfully
sudo systemctl status mongodYou can optionally ensure that MongoDB will start following a system reboot
sudo systemctl enable mongodConfigure MongoDB
mongoSwitch to the built-in admin database:
admin database:use adminCreate an administrative user:
db.createUser( { user: "admin", pwd: "<Enter a secure password>", roles: [ { role: "root", db: "admin" } ] } )Add a new database called nodebb:
nodebb:use nodebbCreate the nodebb user with the appropriate privileges:
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
security:
authorization: enabledRestart MongoDB and verify the administrative user created earlier can connect:
sudo systemctl restart mongod
mongo -u admin -p your_password --authenticationDatabase=adminInstalling NodeBB
First, we must install git as it is used to distribute NodeBB:
sudo apt-get install -y gitgit clone -b v1.16.x https://github.com/NodeBB/NodeBB.git nodebb
cd nodebb
./nodebb setup
./nodebb startInstalling 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 nginxVerify the installation of Nginx
nginx -vRun Nginx
sudo systemctl start nginx
sudo systemctl status nginxConfiguring 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 savedserver {
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 nginxLast updated
Was this helpful?