Installing Ruby on Rails on Debian Lenny

Last night i severely messed up my computer trying to install the latest version of CouchDB. I ran into dependency troubles, and then i uninstalled some kind of essential packages that ended up removing all sorts of things that i rather wanted! But this is okay because i needed a push to move up to the new Debian. And i’m glad i did … Lenny looks nice so far! :)

So i am currently going through the process of installing Ruby on Rails. I’ve never managed to do this right first time, but i always learn a little bit more every time i try. Let’s see if i can nail it this time.

Essential things

I totally wiped the hard drive because it was in such a mess, so i’m going to need some basic stuff like the GNU C Compiler and the ‘make’ tool.

sudo apt-get install gcc make

OpenSSL

In my experience, you must have OpenSSL installed. Other peoples experiences may vary. I download the source code from openssl.org/source and build it like this:

./configure
make
make test
sudo make install

The ‘make test’ is well worth running – it performs loads of checks!

Ruby

Always check rubyonrails.org/down for the recommended version of Ruby. Never install Ruby via apt-get … you may get an incompatible version, and it will likely install it to a weird place. It just makes things messy. Download it, unzip and install like this:

./configure
make
make test
sudo make install

Test that you got it successfully:

ruby --version
ruby 1.8.6 (2008-08-08 patchlevel 286) [i686-linux]

Zlib

Bogdan advises me that the following Zlib steps may be necessary. I have not tested these, but i know i’ve had problems with Zlib in the past, so i think it’s likely that this is a good tip:

Install the development libraries:

apt-get install zlib1g-dev

Install Zlib for Ruby:

wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar zxf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb
make
sudo make install

Gems

Similarly, check the Rails download page to see where to download Gems. I think it’s okay to just get the latest version. Unzip, go into the directory, and use Ruby to install Rubygems.

sudo ruby setup.rb

Again, it’s sensible to check:

gem --version
1.2.0

More than anything, this reassures me that ‘gem’ got into the classpath.

Rails

If Ruby and Gems successfully installed, this bit should be easy.

sudo gem install rails

And that’s it! Oh yeah, of course you could check the install with

rails --version
Rails 2.1.1

Woohoo! And also useful:

gem list
*** LOCAL GEMS ***
actionmailer (2.1.1)
actionpack (2.1.1)
activerecord (2.1.1)
activeresource (2.1.1)
activesupport (2.1.1)
rails (2.1.1)
rake (0.8.2)

SQLite3

Update to add: i just figured out how to get SQLite going on Debian. Download the source from here, compile and install, then:

sudo gem install sqlite3-ruby
Advertisements

18 comments on “Installing Ruby on Rails on Debian Lenny

  1. This didnt work on my system because of missing zlib – here is the added step between ruby and gemsMAKE SURE THAT ZLIB DEV LIBRARIES ARE INSTALLED BEFORE ANY RUBY INSTALLTING BY DOINGapt-get install zlib1g-devTHEN continue with open ssl and ruby configure and suchwget http://www.blue.sky.or.jp/atelier/ruby/ruby-zli… tar zxf ruby-zlib-0.6.0.tar.gzcd ruby-zlib-0.6.0ruby extconf.rbmakemake installthen continue on to the gem install :) Happy Rubying

  2. After spending half a day fooling around with apt-get in my attempt to install Ruby, and I can't tell you how happy I was to have found this post! Straight through, and now I'm ready to learn Ruby!

  3. OMG OMG so pleased to have found this post. I have been looking for a way to install Ruby for ages now! Kudos to you!

  4. So i am currently going through the process of installing Ruby on Rails. I've never managed to do this right first time, but i always learn a little bit more every time i try. Let's see if i can nail it this time.

  5. After spending half a day fooling around with apt-get in my attempt to install Ruby, and I can't tell you how happy I was to have found this post! Straight through, and now I'm ready to learn Ruby!

  6. Thank you so much for this tutorial, I've been having trouble for a while, but now it works perfectly after following your guide.

  7. The way of installing Ruby is tough for me. It caused lot of problems for me. But this helps me a lot. Thanks.Regards.

  8. After spending half a day fooling around with apt-get in my attempt to install Ruby, and I can't tell you how happy I was to have found this post! Straight through, and now I'm ready to learn Ruby!

  9. After spending half a day fooling around with apt-get in my attempt to install Ruby, and I can't tell you how happy I was to have found this post! Straight through, and now I'm ready to learn Ruby!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s