Skip to content

Instantly share code, notes, and snippets.

@joshmcarthur
Forked from mystix/passenger-nginx-setup.sh
Created July 7, 2011 03:23
Show Gist options
  • Save joshmcarthur/1068850 to your computer and use it in GitHub Desktop.
Save joshmcarthur/1068850 to your computer and use it in GitHub Desktop.
Ubuntu 11.04 (Natty) -- RVM + PostgreSQL + Passenger setup script
# run this script on a fresh Ubuntu server installation as root
# copy public ssh key to server's authorized_keys keychain for simple ssh logins
mkdir -p ~/.ssh
echo -e '<your ssh public key here>' > ~/.ssh/authorized_keys
# setup .gemrc
echo -e '---
:verbose: true
:bulk_threshold: 1000
:sources:
- http://rubygems.org
- http://gems.github.com
gem: --no-ri --no-rdoc
:benchmark: false
:update_sources: true
:backtrace: false' > ~/.gemrc
# update ubuntu
aptitude update
aptitude -y dist-upgrade
# setup rvm / postgresql / useful libraries
aptitude -y install build-essential git curl vim rdate htop python-software-properties
# install recommended dependencies as suggested by `rvm notes`
aptitude -y install bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev sqlite3 libsqlite3-0 libxml2-dev libxslt-dev autoconf subversion libcurl4-openssl-dev
# install PostgreSQL
add-apt-repository ppa:pitti/postgresql # install PostgreSQL PPA ((P)ersonal (P)ackage (A)rchive)
aptitude update
aptitude -y install postgresql libpq-dev
# install rvm
bash < <(curl -B http://rvm.beginrescueend.com/install/rvm)
# install ruby 1.9.2 + some global gems
rvm install 1.9.2
rvm use 1.9.2@global
gem install awesome_print map_by_method wirble bundler builder pg
gem install -v2.1.2 builder
# install passenger + nginx
gem install passenger
passenger-install-apache2-module # press Enter to accept, then choose option 2 in order to compile nginx with ssl support
# configure nginx startup script
mkdir /opt/nginx/init.d
wget --no-check-certificate http://github.com/ascarter/nginx-ubuntu-rvm/raw/master/nginx -O /opt/nginx/init.d/nginx
chmod +x /opt/nginx/init.d/nginx
ln -s /opt/nginx/init.d/nginx /etc/init.d/nginx
/etc/init.d/apache2 start
/etc/init.d/apache2 status
/etc/init.d/apache2 stop
# setup new group "wheel" for sudo users
echo Refer to http://articles.slicehost.com/2010/10/18/ubuntu-maverick-setup-part-1#newuser
echo to setup new "wheel" group + sudo users.
echo Remember to add new sudo user to "rvm" group as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment