# Install all the packages
sudo yum install -y \
 curl gpg gcc gcc-c++ make git \
 openssl-devel readline-devel libcurl-devel \
 zlib-devel postgresql-server.x86_64 ruby-devel \
 sqlite sqlite-devel ruby-rdoc python-devel \
 cairo-devel libffi-devel python-pip nc docker \
 tmux htop postgresql-libs postgresql-devel \

# openjdk 11
sudo amazon-linux-extras install java-openjdk11

# install rbenv and ruby
# steps below from https://gist.github.com/luisbebop/71744181980fdd9372c0e85ab8c7299d
git clone git://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
# Install ruby-build system-widely
git clone git://github.com/rbenv/ruby-build.git /tmp/ruby-build
cd /tmp/ruby-build
sudo ./install.sh
rbenv install <ruby_version>

# install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

# install nvm/node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
# install yarn
npm install --global yarn

# reload terminal
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 node

# install jdk-8
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm
sudo yum install -y jdk-8u141-linux-x64.rpm

# enable memory swap (important for micro/nano instances)
# https://aws.amazon.com/premiumsupport/knowledge-center/ec2-memory-swap-file/

# install nginx (needed for letsencrypt setup)
sudo amazon-linux-extras install nginx1.12 -y
sudo service nginx start
# check config file
sudo nginx -t

# install postgres 10
sudo amazon-linux-extras install postgresql10 vim epel -y
sudo /usr/bin/postgresql-setup --initdb
sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo -u postgres -i
# run below in psql:
# CREATE ROLE "ec2-user" LOGIN;
# CREATE DATABASE "ec2-user";
# ALTER USER "ec2-user" createdb;

# instal letsencrypt
# add snippet below to server section of your nginx.conf file (/opt/nginx/conf/nginx.conf)
# location ~ /.well-known {
#   allow all;
#   root /var/www/letsencrypt;
# }
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
# follow https://medium.com/@andrenakkurt/great-guide-thanks-for-putting-this-together-gifford-nowland-c3ce0ea2455
sudo /opt/letsencrypt/certbot-auto certonly --webroot -w /var/www/letsencrypt -d <domain_name>

By admin

Leave a Reply

Your email address will not be published.