Last active
November 29, 2021 01:42
-
-
Save johnrees/1985879 to your computer and use it in GitHub Desktop.
Standard Rails 5.* setup for Ubuntu 14.04 LTS
This file contains 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
# As root user | |
sudo su | |
# Update the OS | |
sudo apt-get update -y | |
# Add this to ~/.bashrc to remove timezone warnings | |
echo 'export LC_ALL="en_US.UTF-8"' >> ~/.bashrc | |
source ~/.bashrc | |
# Install Rails Requirements | |
sudo apt-get install build-essential zlib1g-dev curl git-core python-software-properties software-properties-common libssl-dev openssl libreadline-dev -y | |
# useful extras: libgeoip-dev | |
# Add Deployment User | |
groupadd admin | |
adduser deployer --ingroup admin | |
su deployer | |
# (logout) | |
# brew install ssh-copy-id | |
# ssh-copy-id deployer@SERVER_IP | |
# ssh deployer@SERVER_IP | |
# Say hello to git (expect response: Permission denied (publickey).) | |
ssh [email protected] | |
# generate ssh keys for github if private repo | |
ssh-keygen -t rsa -b 4096 -C "YOUR_EMAIL" | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_rsa | |
cat ~/.ssh/id_rsa.pub # paste in https://github.com/settings/ssh | |
ssh -T [email protected] |
This file contains 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
# capistrano 3 (to run locally) | |
cap production deploy:setup_config | |
cap production deploy |
This file contains 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
# java 8 | |
sudo apt-add-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer |
This file contains 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
git clone https://github.com/letsencrypt/letsencrypt | |
cd letsencrypt | |
./letsencrypt-auto certonly | |
# edit nginx conf (e.g. /etc/nginx/sites-enabled/default) | |
server { | |
listen 443 ssl; | |
server_name YOURDOMAIN.COM; | |
ssl_certificate_key /etc/letsencrypt/live/YOURDOMAIN.COM/privkey.pem; | |
ssl_certificate /etc/letsencrypt/live/YOURDOMAIN.COM/fullchain.pem; | |
# root /var/www/html; | |
# index index.html index.htm index.nginx-debian.html; | |
# location / { | |
# try_files $uri $uri/ =404; | |
# } | |
} | |
# every 90 days | |
./letsencrypt-auto certonly |
This file contains 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
sudo apt-get install mysql-server | |
sudo mysql_install_db | |
sudo mysql_secure_installation |
This file contains 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
# Install latest stable Nginx | |
sudo add-apt-repository ppa:nginx/stable | |
sudo apt-get update -y | |
sudo apt-get install nginx -y | |
service nginx restart |
This file contains 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
# Install Node | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash - | |
sudo apt-get update -y | |
sudo apt-get install nodejs -y |
This file contains 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
# Install Postgres 9.6 | |
sudo sh -c "echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list" | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update -y --fix-missing | |
sudo apt-get install -y libpq-dev postgresql-9.6 | |
sudo -u postgres psql | |
\password # enter a root user password | |
create user <appname> with password 'secret'; | |
create database <appname>_production owner <appname>; | |
\q |
This file contains 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
# Install rbenv | |
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile | |
echo 'eval "$(rbenv init -)"' >> ~/.profile | |
exec $SHELL -l | |
# Install Ruby 2.4.1 | |
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
rbenv rehash | |
rbenv install 2.4.1 | |
# ^ go and get a coffee, rbenv install takes a while | |
rbenv global 2.4.1 | |
# Check installation went OK | |
ruby -v | |
# Install Bundler | |
echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
gem install bundler | |
rbenv rehash |
This file contains 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
# Install Firewall | |
apt-get install ufw -y | |
ufw enable | |
# enable ssh, either on default 22 or a port you change it to | |
ufw allow 22 | |
# enable http etc... | |
ufw allow 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment