Installing Rails on Ubuntu

Once you have the basic knowledge to get started with Rails, we can now concentrate on installing Rails. I would recommend you to go with Ubuntu operating system, which is based on Debian Linux. Its costs almost nothing to install, and Ruby and Rails works well on Linux, and you have got excellent developer tools. So lets gets started. We will assume that you have got a working Ubuntu (version 11.10 or 12.04) on your machine. Launch your terminal and type the following command

$ sudo apt-get 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 libc6-dev ncurses-dev automake

The above command will install necessary tools needed for compilation and installation of Rails. The next stuff is installation of rvm (Ruby virtual machine). So whats is rvm? Ruby is a evolving platform in which many features are added, some unwanted ones dropped off. So you might need one version of Ruby now to start anew Rails project, but then to work on a older one,you need a older version of Ruby. You can switch between different versions of Ruby using the RVM.

To install rvm punch in the following commands into your terminal

$ bash -s stable < <(curl -s

The above command will install rvm on your system. Then to make rvm available via your terminal type this command int your terminal

$ source ~/.bash_profile

Now we need to install latest version of Rails via rvm. when I am writing this blog Ruby 1.9.3 is the latest and stable one. So lets install it by punching the  following commands

$ rvm install 1.9.3

And to use ruby 1.9.3, tell rvm to do so by punching the following line

$ rvm use 1.9.3

This will install Ruby and set it to the specifiedversion. You can verify it by typing this command

$ ruby -v

the above command should return the latest version implementation of Ruby.

Now all we need to do is to install rails. we use a thing called gem ( a package manager in Ruby ) to install Rails. To install Rails ust give this command:

$ gem install rails

Installing Nodejs

Rails uses a language called Coffeescript, which is a language that gets compiled to Javascript. To compile Coffee to Javascript we need a thing called Nodejs. To install it type the following commands one by one.

$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs

And thats it. in future blogs I will be telling how to use rails.

  1. Leave a comment

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: