Skip to content

Instantly share code, notes, and snippets.

@randika
Created October 30, 2011 10:55
Show Gist options
  • Save randika/1325781 to your computer and use it in GitHub Desktop.
Save randika/1325781 to your computer and use it in GitHub Desktop.
Install Ruby 1.9.2 and Rails 3.0 on Ubuntu
$ sudo apt-get install aptitude
Make sure to update once finished.
$ sudo aptitude update
OK now we have aptitude installed on our system and let’s install rvm. There is a shell script already on rvm server for this. To run this script we need git and curl installed on our system.
$ sudo aptitude install build-essential curl git-core
Now install rvm
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
We need to load rvm every time we start a new session, so let's add this line to ~/.bashrc
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
Now close your current shell and open a new shell window session,
and run this command. So the rvm will suggest what other packages we need to install for Ruby to work
#rvm notes
Here is an list of most wanted packages, simply run this in shell prompt.
Make sure to use "sudo" as we need to install them system wide.
(some of them have already installed though)
$ sudo aptitude install 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
UPDATE: 12-02-2011
In your case the packages suggested by rvm notes command, may be slightly different from one listed above.
Finally install ruby 1.9.x with this command. This will take some time so don't panic. Once it’s done, we’ll have Ruby 1.9.2 installed.
$ rvm install 1.9.2
To start using ruby we need to enter
$ rvm use 1.9.2
Verify it with
$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
We can also set this as the default ruby version for the user by calling this command. Once executed selected version will become the default ruby version for the user.
rvm --default use 1.9.2
OK now we can install any gem on this ruby version. So let's install rails 3
gem install rails
Verify your installation
$ rails -v
Rails 3.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment