I think, therefore I blog

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. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food. Click here to subscribe to his weekly blog, or stalk him on Facebook and Twitter.

Leave a Comment

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

Join 3,559 People Who Think Outside The Box

I write every Sunday about travel, psychology, technology, and all sorts of interesting stuff. It's completely free, and you can leave whenever you like. Subscribe now, and you'll be the first to get new articles each week.

Read a Good Book

“A spellbinding true story of love, passion and adventure. One can’t help but be swept away by 100% Love Guaranteed.” —Dr Tammie Matson, author of Elephant Dance.

Chat For A While

Your Vote Matters

Which animal will take over when humans go extinct?