ruby-on-rails

‘Ruby on Rails’  (ROR) is one of the most popular and productive open source framework that allows you to develop web applications very quickly with a lot of fun.

Ruby is a scripting language (like PHP) that focuses on ease of development and beautiful code. Ruby on Rails or simply ‘Rails’ is a web Apps development framework for Ruby programming language.

Rails is a cross-platform – web Apps development framework and this post will guide you in installing ‘Ruby on Rails’ framework on Ubuntu 11.04 (Natty Narwhal) or 10.10 (Maverick Meerkat) or 10.04 (Lucid Lynx) LTS..procedure is same for all versions. gedit text editor is enough for ruby programming – (usually better than heavy weight IDE’s), you can also customize gedit to look like TextMate (very popular (text editor) among ruby developers who uses Mac OS X).

Ruby version 1.8.7 is installed by default, in most of the Linux based operating system or distributions such as Ubuntu, so what you need to install is – ‘Rails’ , Gems (Gems are modular components or libraries very similar to Package in java), git (git is one of the best – free and open source version control system (developed by Linus Torwalds), it is not strictly necessary but recommended) and curl. Before you move on for installing ROR, Apache (Not necessary because ROR ships with WEBrick, the default HTTP server for rails apps) and MySQL or SQLite should be installed.

Installing Ruby on Rails in Ubuntu

#1 : Install git (not necessary but recommended), the version control system.

sudo apt-get install git

or install from source – Download git (Latest Version : 1.7.5.4). Then extract the archive and move to the extracted directory and type the following command(s) to install it –

make && sudo make install

#2 : Install Curl (Command Tool for transferring data with URL Syntax).

Download it (Latest version : 7.21.7) and install in the similar way as you installed git (in step 1, using source)

#3 : Install  Ruby Version Manager (RVM), a command line tool which allows you to run multiple versions of ruby – such as 1.8.7 as well as 1.9.2. Gem will be installed along with this, if not, then install rubygems before proceeding to next step.

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

Then type the command given below, to check whether it has been correctly installed, the output after executing the command will be – ‘rvm is a function’

type rvm | head -1

#4 : Install Ruby 1.9.2 (1.8.7 is installed by default)

rvm install 1.9.2
rvm use 1.9.2

#5 : Install Rails

gem install rails

#6 : Install SQLite3 (Not necessary if you want to use MySQL but ROR uses SQLite database by default, so you need to install ruby and sqlite related packages and ORM libraries).

gem install sqlite3

That’s All..now you are ready to rock with ‘Ruby on Rails’. Create new Application using simple command and start the server.

rails new apps_name
cd apps_name
rails server

Now open your browser and type the following address in the address bar –
http://localhost:3000

Learning Rails ?

Check out this interactive video course on Ruby on Rails at Treehouse.

Update! Checkout my rails application: Railyo – job board for rails Freelancers!

Join the Conversation

15 Comments

  1. Ubuntu does not have ruby installed on it by default. Hasn’t been on 10.10 and isn’t still there on 11.04.

  2. Thank you so much for the informative article ,it is very useful too.please continue this good work.we also providing the Rail service for more details please visit our site:Ruby on Rails Developers

  3. Why when i try to install rails using gem install rail command, it shows like this :

    farahinaman88@ubuntu:~/Downloads/curl-7.21.7$ gem install rails
    ERROR:  Loading command: install (LoadError)
        no such file to load — zlib
    ERROR:  While executing gem … (NameError)
        uninitialized constant Gem::Commands::InstallCommand

  4. I appreciated that your article was the most useful instruction to set up my Ubutnu 11.04 64bit Desktop edition.
    Only one issue is I have to type the command “rvm use 1.9.2” after rebooting.
    Is there any way to use 1.9.2 permanently rather than put it in startup file?

  5. @a3706f261897c26cf2e024b91548cb10:disqus had the same problem. Solution is to check rvm dependencies for ruby.

    $ rvm requirements

    in my case req were:

    $ sudo apt-get install build-essential 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 libtool bison

  6. After installing RVM, the command “type rvm | head -1” failed for me with the error “rvm: not found”. I corrected this by running the following commands

    user$ echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm” # Load RVM function’ >> ~/.bash_profile

    user$ source .bash_profile

    I found this help on the RVM web site

    http://beginrescueend.com/rvm/install/

Leave a comment

Your email address will not be published. Required fields are marked *