Roshan Book

My Tech Notebook

Installing ruby and rails 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
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

One response to “Installing ruby and rails on ubuntu

  1. new york giants jerseys February 1, 2012 at 10:23 am

    After study a few of the blogs inside your website now, and that i really like your own method of running a blog. I bookmarked this to my personal bookmark website itemizing and can be checking again soon. Pls check out my personal web site because nicely as well as tell me what you think.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: