Skip to content

Instantly share code, notes, and snippets.

@tvcam
Last active October 9, 2021 16:31
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 tvcam/8b897201a4a27cb55f29f8ab1af12c2c to your computer and use it in GitHub Desktop.
Save tvcam/8b897201a4a27cb55f29f8ab1af12c2c to your computer and use it in GitHub Desktop.
Setup RoR web server - Ubuntu 20.04
# Apache
sudo apt-get install -y apache2
# Install our PGP key and add HTTPS support for APT
sudo apt-get install -y dirmngr gnupg
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
# Install Passenger + Apache module
sudo apt-get install -y libapache2-mod-passenger
# Mysql server
# https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04
sudo apt install -y mysql-server
# sudo mysql
# CREATE USER 'deployer'@'localhost' IDENTIFIED BY 'password';
# GRANT ALL PRIVILEGES ON *.* TO 'deployer'@'localhost' WITH GRANT OPTION;
# FLUSH PRIVILEGES;
# Redis server
# https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-20-04
sudo apt install -y redis-server
# Lets encrypt
sudo apt install -y certbot python3-certbot-apache
# Dependencies
sudo apt-get install -y libmagickwand-dev libmysqlclient-dev
sudo apt-get install -y libmysqlclient-dev imagemagick build-essential nodejs npm
npm install --global yarn
# Create deploy user
sudo adduser deployer
# mkdir /home/deployer/.ssh
# cp ~/.ssh/authorized_keys /home/deployer/.ssh/
# chown -R deployer /home/deployer/.ssh/
# usermod -aG sudo deployer
# RVM + Ruby
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
\curl -sSL https://get.rvm.io | bash -s stable --ruby
source /home/deployer/.rvm/scripts/rvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment