Skip to content

Instantly share code, notes, and snippets.

@rupert-madden-abbott
Created August 9, 2011 19:58
Show Gist options
  • Save rupert-madden-abbott/1135027 to your computer and use it in GitHub Desktop.
Save rupert-madden-abbott/1135027 to your computer and use it in GitHub Desktop.
Ubuntu first time setup: Rails Development
# After you have finished, you will have the latest version of rvm, Ruby MRI, Passenger and Rails setup and ready to go
# Install dependencies for rvm, ruby, passenger
sudo apt-get install curl git-core libcurl4-openssl-dev build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
# Optional: Install dependencies for capybara-webkit
sudo apt-get install libqt4-dev
# rvm http://beginrescueend.com/rvm/install/
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
# Open ~/.bashrc and change '[ -z "$PS1" ] && return' to 'if [[ -n "$PS1" ]] ; then'
# Close the if statement with 'fi' at the bottom of the file, just before
# [[ -s "/home/foo/.rvm/scripts/rvm" ]] && source "/home/foo/.rvm/scripts/rvm"
# HELP: If anyone knows how to automate this step, please feel free to make suggestions
# Reload your ~/.bashrc
. ~/.bashrc
# Configure rvm
echo >> ~/.rvmrc export rvm_trust_rvmrcs_flag=1 # Automatically trust all .rvmrc files
echo >> ~/.rvmrc rvm_gemset_create_on_use_flag=1 # Create a gemset if it does not exist when trying to switch to it
# List gems to be installed automatically for every Ruby version.
echo -e "bundler\nsqlite3\npassenger" >> ~/.rvm/gemsets/global.gems
# Install Ruby MRI
rvm install 1.9.2
# Switch to Ruby MRI and set as default
rvm use 1.9.2 --default
# Optional: Install redcar
sudo apt-get install openjdk-6-jre
gem install redcar
redcar install
# Create project gemset
rvm gemset use foo
# Install Rails
gem install rails --pre
# Create a new app
rails new foo --skip-bundle
# ExecJS is a dependency of Rails 3.1 and requires a driver. I suggest therubyracer but you can try an
# alternative instead. Add therubyracer (or the alternative driver you installed instead) to your Gemfile
echo "gem 'therubyracer'" >> foo/Gemfile
# Install all gem dependencies
bundle
# Have passenger automatically download and install nginx, then start up your server
passenger start
# Navigate to localhost:3000 and ensure you are greeted with the Rails welcome page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment