Skip to content

Instantly share code, notes, and snippets.

@tanraya
Forked from johnrees/_ubuntu_steps.sh
Created March 23, 2012 16:36
Show Gist options
  • Save tanraya/2172539 to your computer and use it in GitHub Desktop.
Save tanraya/2172539 to your computer and use it in GitHub Desktop.
Standard Rails 3.* setup for Ubuntu 10.04 LTS 32
# As root user
# Update the OS
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
# Setup Hostname & TimeZone
echo "{{HOSTNAME}}" > /etc/hostname
hostname -F /etc/hostname
dpkg-reconfigure tzdata
# Install Rails Requirements
sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev
# Install NGINX
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
sudo service nginx restart
# Install NodeJS
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
# Install Firewall
apt-get install ufw
ufw enable
ufw allow 22
ufw allow 80
# Add Deployment User
useradd -m -g staff -s /bin/bash deploy
passwd deploy
sudo vim /etc/sudoers (add %staff ALL=(ALL) ALL)
# Setup Public Key Access
mkdir -p ~/.ssh
exit
scp ~/.ssh/id_rsa.pub deploy@{{SERVER_IP}}:.ssh/authorized_keys2
# edit sshd_config to have the following settings
sudo vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
PermitRootLogin no
# reload your ssh settings
sudo /etc/init.d/ssh reload
# Connect as Deployment User
ssh deploy@{{SERVER_IP}}
# Setup GIT
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub # copy this output and paste in your github keys
ssh git@github.com
git config --global user.name "{{YOUR NAME}}"
git config --global user.email "{{YOUR EMAIL}}"
# Install Ruby (RBENV) as per http://bit.ly/yr6Sw6
sudo curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
vi ~/.bash_profile
if [[ -d $HOME/.rbenv ]]; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
alias b='bundle exec'
source ~/.bash_profile
rbenv bootstrap-ubuntu-10-04
rbenv install 1.9.3-p0
rbenv global 1.9.3-p0
# Check installation went OK
ruby -v
# Install Bundler
vim ~/.gemrc
gem: --no-ri --no-rdoc
gem install bundler
rbenv rehash
# TODO add Varnish cache, mod GeoIP, *SQL, nginx settings (la $HOME/$APP/current/config/nginx.conf), unicorn settings (la $HOME/$APP/current/config/unicorn.rb), monit
# NB mongo goes onto two seperate 64bit 11.* boxes as a replicated set
# REDIS
# # /etc/apt/sources.list
# deb http://packages.dotdeb.org stable all
# deb-src http://packages.dotdeb.org stable all
# wget http://www.dotdeb.org/dotdeb.gpg
# cat dotdeb.gpg | sudo apt-key add -
# sudo aptitude update
# sudo aptitude install redis-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment