Living on the Edge: How to Install Rails 3-rc and Ruby 1.9.2-rc2 on Ubuntu 10.0.4 LTS

Living on the edge, the view is so much better (Photo: Esparta)

Hey Folks it’s been a while since I posted and a lot has changed in the past few months. Today I’m going to make my come back with a tutorial involving the latest changes in the ruby and rails space. Namely Rails 3-rc and Ruby 1.9.2-rc2, both representing the latest releases from rails and ruby respectively.

First things first is what we’re going to use, our tools include:

This tutorial involves using the Ruby Version Manager (RVM) to install our new ruby and then on top of that we will install the beta release of rails 3. RVM allows you to have many installations of ruby on your system and also lets you switch between the versions easily. I am also assuming that you have worked in ruby and rails before and therefore have a stable version of both already installed including all dependencies and related things like rubygems, git and curl installed.

Install RVM

Now there are quite a few installation requirements that you must have on Ubuntu for your rvm to work properly. According to the RVM website the dependencies can be installed using the following command:

apt-get install curl bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev git-core

Now let’s install RVM, the rvm website gives detailed installation instructions, and it’s as simple as one command.

bash < <( curl )

RVM will do the rest and install onto your system. After a successful installation you should see some notes in your terminal screen that speaks about editing your profile if using bash. Add the line below to the end of your .bashrc file.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

If you have a return in your .bashrc file then rvm may do some strange things and rvm suggests you do the following:

This means that if you see ‘[ -z $PS1 ] && return’ then you must change this line to:

if [[ -n $PS1 ]] ; then

… original content that was below the && return line …

fi # <= be sure to close the if.

#EOF .bashrc

After your installation is complete try running the command “rvm notes”, this will list any dependencies for the system. If you ran the command at the beginning of your installation you should be fine though but it is best to double check.

Like I mentioned earlier the installation information at their website is very detailed, so I suggest double checking what you’ve read here there in case you have any issues.

Install Ruby 1.9.2-rc2

Once rvm has been installed you can begin installing ruby easily. The command is

rvm install 1.9.2-rc2

Check to see if the correct ruby has been installed by using the command:

ruby -v

Note however closing the terminal and reopening brings back the default system ruby. To use your newly installed ruby as default run the command.

rvm 1.9.2 –default

Install Rails 3rc

The release candidate for rails 3 is out. At the time of this writing RC is the current release candidate available. To install this under rvm run the following command:

gem install rails –pre

notice no sudo was used because rvm installs gems locally to the ruby being used and not system wide. From my own experience under Ubuntu I would still get a permission denied error for not using sudo. If you come across this problem use

rvmsudo gem install rails –pre

this is what worked for me.

That’s basically all you need to do to get started with both release candidates of ruby and ruby on rails. It’s a great way to develop new applications that you wish to have running on the latest versions when they are finally released and also a great way to upgrade older applications as well.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.