Skip to content

Instantly share code, notes, and snippets.

@boxpositron
Last active July 21, 2020 11:27
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 boxpositron/adc70a487dd5f63446a17a549013f6a4 to your computer and use it in GitHub Desktop.
Save boxpositron/adc70a487dd5f63446a17a549013f6a4 to your computer and use it in GitHub Desktop.
EC2 Setup Base - NGINX
sudo yum update -y
sudo amazon-linux-extras install epel -y
sudo yum install git -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install 12
sudo yum install gcc-c++ make -y
npm install -g yarn
sudo yum install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
sudo yum install firewalld -y
sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo systemctl status firewalld
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
sudo yum -y install yum-utils
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
sudo yum install certbot python2-certbot-nginx -y
npm install pm2@latest -g
pm2 install pm2-logrotate
pm2 startup
echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew -q" | sudo tee -a /etc/crontab > /dev/null
source ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment