Skip to content

Instantly share code, notes, and snippets.

@trongthanh
Last active May 17, 2020 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save trongthanh/e05524446249ad7727b78941f0e93a01 to your computer and use it in GitHub Desktop.
Save trongthanh/e05524446249ad7727b78941f0e93a01 to your computer and use it in GitHub Desktop.
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