Putting Debian on Ruby rails
So I decided to give it a shot, and see what all the fuzz was about. After all I only had to install 3 things:
But oh boy, had I known the difficulties I was setting myself up for and I probably wouldn’t have…
I have a machine running Debian that I use as my playground for this kind of thing. It was originally just running Apache 1.3 and not much else. The goal was to go from a that “blank” Debian installation to running Ruby on Rails (rubygem version) with a PostgreSQL database backend.
From the beginning I insisted on using apt-get as much as possible since I am Linux-n00b and prefer to stay away from configure and make. Blame my Windows heritage.
Even though this is written in guide/howto-form, it probably should not be taken as such. I am much too inexperienced around this (Debian and Ruby) to actually write a guide. This is merely what worked (and in particular, didn’t work) for me on my installation, if it turns out to work for you too, great! If not, well, too bad…
The stable Debian packages contains an old distribution of Ruby (v1.6.7) which won’t cut it for Gems nor Rails. We have to upgrade to the testing packages:
Edit /etc/apt/sources.list and added the following line:
deb http://http.us.debian.org/debian testing main contrib non-free
Refresh your local package lists:
root@mental$ apt-get update
And you should be about ready to continue. You may have to upgrade a whole bunch of your software at this point.
Install Ruby 1.8.2
Consulting the Rails documentation it turns out installing Ruby-1.8 on it’s own isn’t enough. Ruby is fragmented into a gazillion different packages, but the following should get and install all that’s needed:
apt-get install irb1.8 libbigdecimal-ruby1.8 libcurses-ruby1.8 libdbm-ruby1.8 libdl-ruby1.8 libdrb-ruby1.8 liberb-ruby1.8 libgdbm-ruby1.8 libiconv-ruby1.8 libopenssl-ruby1.8 libpty-ruby1.8 libracc-runtime-ruby1.8 libreadline-ruby1.8 librexml-ruby1.8 libruby1.8 libruby1.8-dbg libsdbm-ruby1.8 libsoap-ruby1.8 libstrscan-ruby1.8 libsyslog-ruby1.8 libtcltk-ruby1.8 libtest-unit-ruby1.8 libtk-ruby1.8 libwebrick-ruby1.8 libxmlrpc-ruby1.8 libyaml-ruby1.8 libzlib-ruby1.8 rdoc1.8 ri1.8 ruby1.8 ruby1.8-dev ruby1.8-elisp ruby1.8-examples libpgsql-ruby1.8
After this, Ruby should work:
jcop@mental$ ruby1.8 -v ruby 1.8.2 (2004-11-23) [i386-linux]
… almost work, at least.
Install zlib for Ruby
It turns out the Ruby testing package doesn’t contain the zlib library for Ruby, so you have to install this manually. No problem, it’s just a matter of downloading it followed by
tar -zxvf ruby-zlib-0.6.0.tar.gz<br /> cd ruby-zlib-0.6.0<br /> /usr/bin/ruby1.8 extconf.rb<br /> make install<br />
Assuming you already have zlib installed you are now ready to install RubyGems
wget http://rubyforge.org/frs/download.php/1399/rubygems-0.8.1.tgz tar -zxvf rubygems-0.8.1.tgz cd rubygems-0.8.1 ruby1.8 install.rb
Simple, huh? Yup, but not quite…
It turns out there is a problem with running RubyGems on Ruby 1.8.2. Basically it’ll give you an error (“string contains null byte”) or something to that effect whenever you try to install a gem.
Since apt-get won’t give us Ruby 1.8.1 and I want to use apt and RubyGems I was stuck at this point for a while, while trying out different workarounds to no avail and becoming increasingly frustrated.
#rubyonrails to the rescue! Apply this patch to RubyGems, and your worries disappear.
gem install rails
Due to us running Ruby 1.8.2, which is an unstable CVS checkout as far as I can gather we need to have this patch applied.
After this, you should be able to take on the tutorial from around step 2.
See, it wasn’t that bad…