Skip to content

Instantly share code, notes, and snippets.

@gmaliar
Last active December 22, 2015 15:38
Show Gist options
  • Save gmaliar/6493643 to your computer and use it in GitHub Desktop.
Save gmaliar/6493643 to your computer and use it in GitHub Desktop.
A quick guide to installing ruby and rails on a clean installation of ubuntu

Assuming you are using Ubuntu 12.04 / 12.10 / 13.04

Mac users go here to do the same with Homebrew

https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x

and continue to install ruby 2.0.0

First install git

$ sudo apt-get install git-core

Then install rbenv

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
$ echo 'eval "$(rbenv init -)"' >> ~/.profile
$ exec $SHELL -l
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

Now that we have rbenv installed we can install Ruby with ease

$ rbenv install 2.0.0-p247
$ rbenv rehash

Let's make ruby 2.0 the global version of ruby used on the system

$ rbenv global 2.0.0-p247

Let's check out this is correct

$ ruby -v
# Output something similiar to: ruby 2.0.0-p247 (2013-01-07 trunk 38733) [x86_64-darwin12.3.0]

Install Rails 3.2.12

$ echo "gem: --no-document" >> ~/.gemrc
$ gem install rails --version=3.2.14
$ rbenv rehash
$ rails -v
# Output something similar to: Rails 3.2.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment