Last active
March 20, 2023 16:20
-
-
Save aqkhan/a5a5778a6eaffc1a4546863f680da82f to your computer and use it in GitHub Desktop.
Install nginx, git, nvm, node, yarn, and PM2 on Amazon Linux 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Create the file | |
nano ask.sh | |
# Paste the contents of the file | |
# Give permissions to the shell script | |
chmod +x ask.sh | |
# Run the file | |
./ask.sh | |
echo "AlphaSquad Starter kit for Amazon Linux 2" | |
echo "----------------------------------------" | |
# Basic projects setup | |
mkdir projects | |
chown $USER projects | |
cd projects | |
echo pwd | |
echo "Installing NGINX" | |
sudo amazon-linux-extras install -y nginx1 | |
echo "----------------------------------------" | |
echo "Installing Git" | |
sudo yum update -y | |
sudo yum install git -y | |
git version | |
echo "----------------------------------------" | |
echo "Installing NVM, Node, & GCC C++" | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash | |
source ~/.bashrc | |
# Install node LTS | |
nvm install 16.18.1 | |
yum install gcc-c++ | |
echo "----------------------------------------" | |
echo "Installing Yarn" | |
npm i -g yarn | |
echo "----------------------------------------" | |
echo "Installing PM2" | |
npm i -g pm2 | |
# pm2 start npm -- start | |
echo "----------------------------------------" | |
# sudo nano /etc/httpd/conf/httpd.conf | |
# Rerstart Apache | |
# sudo systemctl restart httpd.service | |
# Show Apache status | |
# sudo systemctl status httpd.service | |
# Redirecting /path to a different server | |
# <VirtualHost _default_:80> | |
# ServerAlias * | |
# ServerName rms.center-piece.com | |
# ProxyErrorOverride On | |
# RequestHeader set X-Forwarded-Proto https | |
# ProxyAddHeaders On | |
# <Location "/"> | |
# ProxyPass http://localhost:4000/ | |
# ProxyPassReverse http://localhost:4000/ | |
# </Location> | |
# <Location "/rms-api"> | |
# ProxyPreserveHost On | |
# ProxyPass "http://10.0.10.168:80" retry=0 | |
# </Location> | |
# </VirtualHost> | |
# <VirtualHost _default_:443> | |
# ServerAlias * | |
# ProxyPass / http://localhost:4000/ | |
# ProxyPassReverse / http://localhost:4000/ | |
# </VirtualHost> | |
# curl -sb -H "Accept: application/json" "https://rms.center-piece.com/rms-api" | |
# Forward traffic from one instance to another | |
# Default nginx conf path: | |
# /etc/nginx/nginx.conf | |
# Add the following line under http {} | |
# include /etc/nginx/sites-enabled/* | |
# mkdir sites-enabled && cd sites-enabled | |
# sudo nano default | |
# upstream api-server { | |
# server 10.0.150.15:80; | |
# } | |
# server { | |
# listen 80 default_server; | |
# location / { | |
# proxy_pass http://localhost:4000; | |
# proxy_http_version 1.1; | |
# proxy_set_header Upgrade $http_upgrade; | |
# proxy_set_header Connection 'upgrade'; | |
# proxy_set_header Host $host; | |
# proxy_cache_bypass $http_upgrade; | |
# } | |
# location /api { | |
# proxy_pass http://api-server/; | |
# proxy_http_version 1.1; | |
# proxy_set_header Upgrade $http_upgrade; | |
# proxy_set_header Connection 'upgrade'; | |
# proxy_set_header Host $host; | |
# proxy_cache_bypass $http_upgrade; | |
# } | |
# } | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment