Skip to content

Instantly share code, notes, and snippets.

@atamis
Created April 12, 2012 04:25
Show Gist options
  • Save atamis/2364576 to your computer and use it in GitHub Desktop.
Save atamis/2364576 to your computer and use it in GitHub Desktop.
Quick and simple install script for nginx, passenger, and rails
#!/bin/bash
# Gotta get me some colors
echo "Updating package listing"
sudo apt-get update
echo "Installing packages"
sudo apt-get install -y curl git-core build-essential bison \
openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev \
libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev autoconf libc6-dev mysql-server libmysqlclient15-dev \
postgresql libpq-dev libcurl4-openssl-dev zlib1g-dev
sudo apt-get upgrade
echo "removing ruby"
sudo apt-get remove -y ruby
echo "Installing RVM"
curl -L get.rvm.io | bash -s stable
RVM="[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && . \"$HOME/.rvm/scripts/rvm\""
echo $RVM
echo $RVM >> ~/.bashrc
echo "Reloading RVM"
source /home/vagrant/.rvm/scripts/rvm
echo "Installing ruby 1.9.3"
rvm install 1.9.3
rvm --default use 1.9.3
rvm 1.9.2 --passenger
rvm 1.9.2
echo "Installing passenger and nginx"
gem install passenger
rvmsudo passenger-install-nginx-module
echo "Installing nginx init.d script"
git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git
sudo cp rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
sudo chown root:root /etc/init.d/nginx
echo "
run...
bundle install
Adjust database.yml
production:
adapter: mysql2
encoding: utf8
database: [database name]
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
run...
RAILS_ENV=production rake db:setup
rake assets:precompile
Add...
root /vagrant/[app name]/public; # <--- be sure to point to 'public'!
passenger_enabled on;
to the server directive in /opt/nginx/conf/nginx.conf
/etc/init.d/nginx restart
Access at port 80.
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment