Archive

Archive for the ‘Ruby On Rails’ Category

RubyOnRails(RoR) on Ubuntu 10.10

April 14, 2011 Leave a comment

Recently I had installed RubyOnRails on Ubuntu 10.10. If you are a beginner, you would find very much confusing to understand why those components were required in the first place.All we need is just couple of commands as below to get RoR application up and running!

sudo apt-get install ruby
sudo apt-get install gems
sudo gem install rails
mkdir <Application Directory Path>

rails new <Application Directory Path>
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby
cd <Application Directory Path>

rails server

Installed Versions:
Ruby 1.8.7
RubyGems 1.3.7
Rails 3.0.6

Here are some tips and observations :

(1) Tried to install with ‘sudo gem install rails’ and it gave ‘File not found: lib’ error
$ sudo gem install rails
Successfully installed rails-3.0.6
1 gem installed
Installing ri documentation for rails-3.0.6…
File not found :lib

Solution:
sudo gem install rdoc-data
sudo gem rdoc –all –overwrite
Then run ‘sudo gem install rails’.

(2) sudo gem install rails hangs or takes too much time
When I ran the command, it seems like it was hanging, but apparently it came back with successful installation. So even though it seems like taking too much time, hang in there.

$ sudo gem install rails
Successfully installed rails-3.0.6
1 gem installed
Installing ri documentation for rails-3.0.6…
Installing RDoc documentation for rails-3.0.6…

(3) Dont forget to add the GEM path to PATH
$ gem env
RubyGems Environment:
– RUBYGEMS VERSION: 1.3.7
– RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
– INSTALLATION DIRECTORY: /var/lib/gems/1.8
– RUBY EXECUTABLE: /usr/bin/ruby1.8
– EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
– RUBYGEMS PLATFORMS:
– ruby
– x86-linux
– GEM PATHS:
     – /var/lib/gems/1.8
– /home/testuser/.gem/ruby/1.8
– GEM CONFIGURATION:
– :update_sources => true
– :verbose => true
– :benchmark => false
– :backtrace => false
– :bulk_threshold => 1000
– REMOTE SOURCES:

$ export PATH = $PATH:/var/lib/gems/1.8/bin
(4) ‘Could not find sqlite3’ error while running “rails server” even after trying to install using sudo gem install sqlite3
$ rails server
Could not find gem ‘sqlite3 (>= 0, runtime)’ in any of the gem sources listed in your Gemfile.

Solution:
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

Good Resource Link is here!.

Advertisements