How To Install Ruby On Rails On Ubuntu Hardy 8.04

By , 20 September 2012

How To Install Ruby On Rails On Ubuntu Hardy 8.04
How To Install Ruby On Rails On Ubuntu Hardy 8.04

Okay, Ubuntu Hardy is pretty old now but my Hardy server is still humming along just fine and I don't see a good reason to break it just to run a few Ruby On Rails apps. The ruby, ruby1.9 and rubygems packages on Hardy simply don't work anymore and the rails package is too old to run my app.

So here is how I got the latest rails running on this 4 year old server. I hope it saves you some pain.

1. Install JRuby 1.6.8. The Ubuntu ruby1.9 package just hangs silently when trying to install rubygems, but JRuby does the job.

    # cd /opt
    # wget http://jruby.org.s3.amazonaws.com/downloads/1.6.8/jruby-bin-1.6.8.tar.gz
    # tar -zxf jruby-bin-1.6.8.tar.gz
    # export PATH=$PATH:/opt/jruby-1.6.8/bin

2. Install Rubygems 1.8.24

    # wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.zip
    # unzip rubygems-1.8.24.zip
    # cd /opt/rubygems-1.8.24
    # jruby setup.rb
How To Install Ruby On Rails On Ubuntu Hardy 8.04

3. Patch rubygems. Out of the box, jgems produces the following error:


 
    # jgem --help
    /opt/jruby-1.6.8/bin/jgem: line 13: syntax error near unexpected token `Gem::QuickLoader'
    /opt/jruby-1.6.8/bin/jgem: line 13: `if RUBY_VERSION =~ /^1\.9\.1/ && defined?(Gem::QuickLoader)'

You can fix it by changing the first line of /opt/jruby-1.6.8/bin/jgem to

    #!/usr/bin/env /opt/jruby-1.6.8/bin/jruby

 

4. Install rails and some extras.

    # jgem install rails
    # jgem install jruby-openssl

5. Test it out!

    # rails new /tmp/app
    # cd /tmp/app
    # rails server

Make sure your firewall has port 3000 open, and visit http://localhost:3000 .

Hope that works for you.

 

About Roger Keays

How To Install Ruby On Rails On Ubuntu Hardy 8.04

Roger Keays is an artist, an engineer, and a student of life. He has no fixed address and has left footprints on 40-something different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, the proper use of semicolons, and finding good food.

Leave a Comment

Please visit https://rogerkeays.com/how-to-install-ruby-on-rails-on-ubuntu-hardy-8-04 to add your comments.