Ruby on Rails in Ubuntu

Install the Dependencies:
Build-essentials

Ruby:
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p129.tar.gz
$ tar -xzvf ruby-1.9.1-p129.tar.gz

change directory to the extracted directory

$ sudo ./configure
$ sudo make
$ sudo make install

RubyGems:
$ wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz
$ tar -xzvf rubygems-1.3.4.tgz

change directory to the extracted directory

$ sudo ruby setup.rb
$ gem -v

Rails:
$ sudo gem install rails --include-dependencies

Terminal Output:
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
7 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.2...
Installing ri documentation for activerecord-2.3.2...
Installing ri documentation for actionpack-2.3.2...
Installing ri documentation for actionmailer-2.3.2...
Installing ri documentation for activeresource-2.3.2...
Installing ri documentation for rails-2.3.2...
Updating class cache with 1382 classes...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.2...
Installing RDoc documentation for activerecord-2.3.2...
Installing RDoc documentation for actionpack-2.3.2...
Installing RDoc documentation for actionmailer-2.3.2...
Installing RDoc documentation for activeresource-2.3.2...
Installing RDoc documentation for rails-2.3.2...

List the installed gem files
$ gem list --local

Create the Web Directory
$ cd /var/www
$ sudo mkdir rubyweb
$ cd rubyweb/
$ sudo rails myweb

Running RoR for the first time:
$ ruby script/server
___
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:269:in `rescue in require_frameworks': no such file to load -- openssl (RuntimeError)
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:266:in `require_frameworks'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:134:in `process'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/initializer.rb:113:in `run'
from /var/www/rubyweb/myweb/config/environment.rb:9:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/commands/server.rb:84:in `<top (required)>'
from script/server:3:in `require'
from script/server:3:in `<main>'

If you encounter the above error, run the following to fix the error

$ sudo apt-get install openssl libssl-dev
$ sudo apt-get install ruby1.9-dev
$ cd /usr/src/ruby-1.9.1-p129/ext/openssl
$ sudo ruby extconf.rb
$ sudo make && make install

Run the server again.
$ cd /var/www/rubyweb/myweb
$ ruby script/server

Comments

  1. thanks a ton!

    do you know if this is caused by just not having the ssl packages during compilation, or is this an ubuntu problem?

    ReplyDelete
  2. huge thanx!!!
    i could make my application run. i was searchin a lot

    ReplyDelete

Post a Comment

Popular posts from this blog

Radiator Radius Installation connecting to ORACLE (CentOS)

Scraping an Entire Website using LINUX

How to enable clustering in Openfire Enterprise?