Skip to content

Instantly share code, notes, and snippets.

@websymphony
Forked from johnrees/_ubuntu_steps.sh
Created October 7, 2012 18:19
Show Gist options
  • Save websymphony/3849137 to your computer and use it in GitHub Desktop.
Save websymphony/3849137 to your computer and use it in GitHub Desktop.
Standard Rails 3.* setup for Ubuntu 12.04 LTS 32
# As root user
sudo su
# Update the OS
apt-get update -y
apt-get dist-upgrade -y
apt-get upgrade -y
# Setup Hostname & TimeZone
echo "{{HOSTNAME}}" > /etc/hostname
hostname -F /etc/hostname
dpkg-reconfigure tzdata
# Install Rails Requirements
apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev -y
# Install NGINX & NODE
apt-get install python-software-properties -y
add-apt-repository ppa:nginx/stable
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nginx nodejs -y
sudo service nginx restart
# Install Firewall
apt-get install ufw -y
ufw enable
ufw allow 22
ufw allow 80
# Add Deployment User
groupadd admin
adduser deployer --ingroup admin
su deployer
# ssh-copy-id keys to server
# Setup GIT
ssh [email protected]
# Install Ruby (RBENV) as per http://bit.ly/yr6Sw6
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-12-04
rbenv install 1.9.3-p194
rbenv global 1.9.3-p194
# Check installation went OK
ruby -v
# Install Bundler
vim ~/.gemrc
gem: --no-ri --no-rdoc
gem install bundler
rbenv rehash
Postgress Installation
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 libpq-dev
sudo nano /etc/postgresql/9.2/main/pg_hba.conf
local all postgres ident
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
To see existing db and users
sudo -u postgres psql -l
Nokogiri gem dependency
sudo apt-get install libxslt-dev libxml2-dev
/usr/local/pgsql/bin/initdb --locale=en_US.UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment