Skip to content

Instantly share code, notes, and snippets.

@nathantannar4
Created August 10, 2018 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathantannar4/4766c56b9307a9b47954426ec06b6518 to your computer and use it in GitHub Desktop.
Save nathantannar4/4766c56b9307a9b47954426ec06b6518 to your computer and use it in GitHub Desktop.
My install script for new GCP instances to install all the necessities.
#!/bin/bash
# Prefer IPv4 over IPv6 - make apt-get faster
sudo sed -i "s/#precedence ::ffff:0:0\/96 100/precedence ::ffff:0:0\/96 100/" /etc/gai.conf
# Update Packages
sudo apt-get update -y
sudo apt-get upgrade -y
# Nano Editor
sudo apt-get install nano -y
# Screen
sudo apt-get install screen -y
# Add Swapfile
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# ufw Firewall
sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443
sudo ufw --force enable
# NodeJS
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y npm
# Git
sudo apt-get install git -y
git config --global user.name "Nathan Tannar"
git config --global user.email nathantannar4@gmail.com
# NGINX
sudo apt-get install nginx -y
sudo service nginx stop
sudo rm -r /etc/nginx
sudo git clone https://github.com/nathantannar4/nginx-config /etc/nginx
rm -r /usr/share/nginx/html
sudo service nginx start
# Vapor
eval "$(curl -sL https://apt.vapor.sh)"
sudo apt-get install swift vapor -y
# MySQL
sudo apt-get install mysql-server
mysql_secure_installation
# MongoDB
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get install -y mongodb-org=4.0.1 mongodb-org-server=4.0.1 mongodb-org-shell=4.0.1 mongodb-org-mongos=4.0.1 mongodb-org-tools=4.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment