Initial Server Setup Digital Ocean for the following servicesInstall* Server updates* NodeJS * Nginx * MongoDB* PM2Configure* MongoDB
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04
ssh root@SERVER_IP_ADDRESS
sudo apt-get update && sudo apt-get upgrade -y
apt-get install
apt list --upgradable -a
apt update
apt upgrade
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
sudo apt-get update
sudo apt-get install -y nginx
Now test your serve by accessing your server's ip adress on Google Chrome.
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
sudo nano /etc/systemd/system/mongodb.service
Paste this code
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
Inicia o MongoDB
sudo systemctl start mongodb
Checa o Status do MongoDB
sudo systemctl status mongodb
Configura para o MongoDB iniciar automaticamente
sudo systemctl enable mongodb
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
Set the permission that enables mongo to be accessed through this user@serverIP
mongo
ssh -L 4321:localhost:27017 user@your.ip.address -f -N
mongo --port 4321
Edit your /etc/mongod.conf
configuration
Replace
bindIp: 127.0.0.1
For
bindIpAll: true
This will enable acces at IPv4 and IPv6
Reboot your server
reboot
Don't forget to change your DB address at the backEnd
'mongodb://your.ip.address/your.db.name'
Try access with MongoDB Compass
https://www.digitalocean.com/community/tutorials/how-to-use-the-mongodb-one-click-application
sudo npm install -g pm2
Navigate util your folder and run
pm2 startup upstart
pm2 save
node -v
nginx -v
mongo --version
pm2 -v
service --status-all