How to install Ruby on Rails in Ubuntu 8.10 (Intrepid)

Sponsored Link
Rails is a web development framework written in the Ruby language. It is designed to make programming web applications easier by making several assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks. Longtime Rails developers also report that it makes web application development more fun.

Install Ruby in Ubuntu 8.10

Install the following packages for ruby

sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sqlite3 libsqlite3-ruby1.8

Note:- Rails version 2.0+ uses sqlite3 as its default database.

Create Symbolic links

We need to create some symlinks from the install to locations every programme would look for

sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby

sudo ln -s /usr/bin/ri1.8 /usr/bin/ri

sudo ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc

sudo ln -s /usr/bin/irb1.8 /usr/bin/irb

Check Ruby Version

If you want to check ruby version use the following command

ruby -v

Rubygems

RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries , a tool designed to easily manage the installation of gems, and a server for distributing them.

RubyGems Features

Easy Installation and removal of RubyGems packages and their dependents.
Management and control of local packages
Package dependency management
Query, search and list local and remote packages
Multiple version support for installed packages
Web-based interface to view the documentation for your installed gems
Easy to use interface for building gem packages
Simple server for distributing your own gem packages

Now you can download latest rubygems from here

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz

Unpack rubygems-1.3.1.tgz file using the following command

tar xzvf rubygems-1.3.1.tgz

cd rubygems-1.3.1

Install rubygem using the following command

sudo ruby setup.rb

This will complete the rubygem installation.

Now create a symbolic link using the following command

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Check gem version using the following command

gem -v

Update gem packages using the following command

sudo gem update --system

Install Rails

Now we need to continue rails installation with the following command

sudo gem install rails

you can check what gems were installed with

sudo gem list

Testing sqlite3 database

Now we can do a simple test to see if the sqlite3 module is working

irb
...
irb(main):001:0> require ‘sqlite3'
=> true
irb(main):002:0> exit

If the result does not return ‘true' the you may have missed a step.

Postfix and subversion

Finally, we need to install postfix and subversion so we can ‘check-out' plugins and send mail from our Rails applications

sudo aptitude install postfix subversion -y

Answer the postfix questions as you see fit but the defaults usually suffice for our purposes as we are only using it to send emails and not for receiving mail.

OK now have a Ruby on Rails and postfix/subversion stack setup and ready to roll.Now you are ready to install the server of your choice whether that be Litespeed, Nginx or Apache.

Sponsored Link

You may also like...

8 Responses

  1. 9985 says:

    isnt “apt-get install rails” do the same thing

  2. Kin says:

    @9985 – no, it is recommend that you install Rails from the latest gem packages. Ubuntu is almost always out of date with Rails, hence the recommendation to get gems separately.

    Good write-up. I’d never thought to put the symlinks in, I’ve just been using full names, eg gem1.8, thanks for the simple yet effective tip.

    Additional note, if you want to use MySQL (which you will at some point) then you’ll need to get a gem to support this as it is no longer default in Rails. A google will soon find you the right package.

  3. paul says:

    having a problem with following your instructions; and I have had the same problem w/ other similar tutorials. I’m a linux newbie, running Ubuntu 8.10. I followed your instructions exactly, but when I get to the command

    sudo gem update — system

    I get an error
    /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’: no such file to load — zlib (LoadError)
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run’
    from /usr/local/bin/gem:21

    I tried it as –system as well, in case your space was a typo.

    Anyway, any advice? this seems like pretty straightforward instructions, so I don’t know how to debug the error. I checked Ruby and gem and both show versions listed in your tutorial.

    Thanks,
    Paul

  4. Umuro says:

    Rails 2.3 provides new possibilities. Templates mean faster project initiation. And latest developments mean lesser installation.

    This tutorial is fully tested on Ubuntu Jaunty:
    Rais101 Tutorial Ruby on Rails with Relations http://conceptspace.wikidot.com/blog:19

    Get the taste of having a production quality online database in minutes….

    Ubuntu 9.04
    Rails 2.3.2

  5. D Bram says:

    Paul,

    The instruction line is “sudo gem update — system” where there is a space between ‘update’ and two hyphens and another space between the two hyphens and system.

    Hope that helps.

  6. katarashop says:

    i’m trying step by step … but ruby script/server RuntimeError, openssl not found, …
    please help me … ^_^

    thanks before

  7. nixin says:

    Yo best tutorial for rails and ubuntu 8.10 simply the BEST! I was having a hard time installing this and this simple tutorial did the trick. TY!

  8. nixin says:

    katarashop I think you need to create a rails app before you dive into Webrick.

    Try Commands … rails test
    cd test
    ruby script/server

    You should see it work after doing that.

Leave a Reply

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