Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu Node Server Setup
#!/bin/bash
# NOTE: The commands here only applicable for Ubuntu 16.04 Xenial, do not use it for other distros
# Update server to latest packages
sudo apt update && sudo apt upgrade -y
# Install nginx and git
sudo apt install -y nginx git
# Install latest NodeJS LTS
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install -y nodejs
# Install MongoDB
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 update && sudo apt install -y mongodb-org
# Start mongod service
sudo systemctl start mongod
# Enable mongod service auto restart
sudo systemctl enable mongod
echo "Ubuntu system initialization complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment