Ruby and Debian


#1

I don’t wish to open a can of worms here. I’m not even a Debian
user, I’m just trying to help a friend.

Please refrain if you can from digressing into discussions of politics,
licenses, package management, rubygems replacements, or “my distro can
beat up your distro.”

I met with a friend at breakfast this morning. Coffee shop with killer
pastries and wi-fi, ahhhh.

He’s a Debian guy. Our purpose in meeting was to install Ruby and
rubygems
and one other library and then play with it a little. (He doesn’t know
Ruby yet.)

He tried an apt-get before I got there. After fiddling a bit, I
suggested
installing from source – rubygems was complaining about zlib.

We installed from source, got no zlib, thus rubygems crashed. Tried an
apt-get of zlib-ruby, but no joy. Version conflict or something.

Gave up, moved to a different server, did everything the “right” way.
Wasted over an hour. Never got ruby/zlib/rubygems all installed properly
on either box.

Moved to a Red Hat server where it all “just worked.”

What’s the magic to get this going on Debian?

Thanks,
Hal


#2

Hal F. wrote:

What’s the magic to get this going on Debian?

Last time I tried this, I discovered that Ruby is split into a whole lot
of packages. I’m sure there’s a really good reason the packagers split
Ruby into so many packages, but I’ve found that installing from source
is quicker and easier if you want everything. Maybe the packages are
useful for people who want a minimal install.

Sorry, I realize this isn’t the most helpful answer.

Jen


#3

stable:

aptitude install zlib1g-dev

then try to configure and compile ruby again.


#4

On 12/16/05, Hal F. removed_email_address@domain.invalid wrote:

What’s the magic to get this going on Debian?

Assuming you’re using Ruby 1.8 you need to

apt-get install libruby1.8

it replaces libzlib-ruby1.8

FWIW I’ve never used libzlib, but have (and do) use ruby on debian.

I usually use debian’s ruby package, and libs such as fcgi/mysql
I haven’t seen a rubygem package for debian since 8.4, which can still
be used if you do the following

gem install rubygems-update

AND

update_rubygems

Although it’s just as easy to install rubygems from source, and lately
I’ve just been doing that.

For Rails, I ALWAYS use rubygems to install it. I’ve never had luck
with the debian packages.

Obviously it’s kind of a try and see type of thing, there really is no
“right way”.
As silly as this sounds, I typically install gems via gem (rubygems)
and anything that starts with lib via apt. :wink:

The following commands help alot while searching for ruby packages via
apt, just replace “libruby1.8” with whatever you’re looking for.
apt-cache search libruby1.8 | grep ruby
apt-cache search ruby | grep libruby1.8
apt-cache show libruby1.8

HTH


Chris M.
Web D.
Open Source & Web Standards Advocate
http://www.chriscodes.com/


#5

Now I’m having trouble compliling ruby 1.8.3 on Debian stable with tk
support so I can play rrobots. Anyone help here?


#6

On 12/16/05, Hal F. removed_email_address@domain.invalid wrote:

What’s the magic to get this going on Debian?

Thanks,
Hal

Hal-

After quite a few times experimenting to get a nice setup for ruby

and rails on debian, I wrote a detailed tutorial[1]. The tutorial
covers some stuff you probably don’t need or already have installed
but it does install a fully working ruby and gems plus other goodies
like Imagemagick and Rmagick plus the mysql-ruby bindings. So you can
probably find what you need in it.

[1] http://brainspl.at/rails_stack.html

Cheers-

-Ezra


#7

Hi:

On Sat, Dec 17, 2005 at 03:51:29PM +0900, Hal F. wrote:

He’s a Debian guy. Our purpose in meeting was to install Ruby and rubygems
and one other library and then play with it a little. (He doesn’t know
Ruby yet.)

He tried an apt-get before I got there. After fiddling a bit, I suggested
installing from source – rubygems was complaining about zlib.
[…]

Is he using Debian stable? Is it a server? That is supposed to have 

been
fixed months ago (in sid and testing).

If he's indeed using stable, you'll have to install a couple of 

packages
to have a complete Ruby installation. There was a guide somewhere in the
Rails
Wiki (it doesn’t work for me right now, network problems?).

HTH,

#8
  • jennyw jennyw (removed_email_address@domain.invalid) wrote:

Hal F. wrote:

What’s the magic to get this going on Debian?

Last time I tried this, I discovered that Ruby is split into a whole lot
of packages. I’m sure there’s a really good reason the packagers split
Ruby into so many packages, but I’ve found that installing from source
is quicker and easier if you want everything. Maybe the packages are
useful for people who want a minimal install.

They fixed this brain-dead policy recently.

I use Debian for everything personally, but adding “this library is in
the standard library, except in Debian” to my documentation was getting
a bit old.


#9
  • Chris M. (removed_email_address@domain.invalid) wrote:

On 12/16/05, Hal F. removed_email_address@domain.invalid wrote:

What’s the magic to get this going on Debian?
[snipped]
The following commands help alot while searching for ruby packages via
apt, just replace “libruby1.8” with whatever you’re looking for.
apt-cache search libruby1.8 | grep ruby
apt-cache search ruby | grep libruby1.8
apt-cache show libruby1.8

save your fingers and keep your hair

alias acs=‘apt-cache search --names-only’

Produces:

pabs@halcyon:~> acs libruby
libruby - Libraries necessary to run Ruby 1.8.x
libruby1.6 - Libraries necessary to run Ruby 1.6.x
libruby1.6-dbg - Debugging libraries for Ruby 1.6.x
libruby1.8 - Libraries necessary to run Ruby 1.8
libruby1.8-dbg - Debugging libraries for Ruby 1.8
libruby1.9 - Libraries necessary to run Ruby 1.9
libruby1.9-dbg - Debugging libraries for Ruby 1.9


#10
  • Hal F. (removed_email_address@domain.invalid) wrote:

He’s a Debian guy. Our purpose in meeting was to install Ruby and rubygems
and one other library and then play with it a little. (He doesn’t know
Ruby yet.)

He tried an apt-get before I got there. After fiddling a bit, I suggested
installing from source – rubygems was complaining about zlib.

We installed from source, got no zlib, thus rubygems crashed. Tried an
apt-get of zlib-ruby, but no joy. Version conflict or something.

If you’re installing from source, you need zlib1g-dev (in Debianese,
“-dev” suffix == header files).

Gave up, moved to a different server, did everything the “right” way.
Wasted over an hour. Never got ruby/zlib/rubygems all installed properly
on either box.

Depending on the version of Debian (I’m using Sid, so the way things are
for me are how they’ll be for you eventually), it should be this
simple:

install ruby and ruby development packages

sudo apt-get install ruby1.8{,-dev} libruby1.8

install gems from source

gem_url=‘http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
wget $gem_url && tar zxf rubygems-0.8.11.tar.gz &&
cd rubygems-0.8.11 && sudo ruby setup.rb

If zlib wasn’t listed as a dependency for libruby1.8 on the system in
question, it is now (in the more recent versions):

pabs@halcyon:~> ach libruby1.8 | grep Dep.*zlib
Depends: libc6 (>= 2.3.5-1), libncurses5 (>= 5.4-5), zlib1g (>=
1:1.2.1)


#11

Hal F. wrote:

He’s a Debian guy. Our purpose in meeting was to install Ruby and rubygems
and one other library and then play with it a little. (He doesn’t know
Ruby yet.)

He tried an apt-get before I got there. After fiddling a bit, I suggested
installing from source – rubygems was complaining about zlib.

Probably not such a good idea, because then you lose dependency
handling.

We installed from source, got no zlib, thus rubygems crashed.

Sounds like a bug in Ruby. The ./configure ought to test for the
presence of zlib. I’d report the bug.

Gave up, moved to a different server, did everything the “right” way.
Wasted over an hour. Never got ruby/zlib/rubygems all installed properly
on either box.

Well, I’ve got a vanilla debian-stable server hanging around that I’ve
never done any Ruby work on, so I’ve just tried the obvious ‘right’ way
of doing everything, and it all worked first time:

apt-get install ruby

Reading package lists… Done
Building dependency tree… Done
The following extra packages will be installed:
libruby1.8 ruby1.8
Suggested packages:
ruby1.8-examples rdoc1.8 ri1.8
The following NEW packages will be installed:
libruby1.8 ruby ruby1.8
0 upgraded, 3 newly installed, 0 to remove and 4 not upgraded.
Need to get 1500kB/1519kB of archives.
After unpacking 5837kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
[Stuff scrolls past]

wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz

tar -xzf rubygems-0.8.11.tgz

cd rubygems-0.8.11

ruby setup.rb

[Stuff scrolls past]

gem install vim-ruby

[Stuff scrolls past]
Successfully installed vim-ruby-2005.10.07

I note also that ruby correctly has zlib as a dependency in Debian
stable. So apt-get install ruby should have installed zlib even if it
was missing.

So I’m guessing your friend’s debian box is b0rked in some major way.

mathew


#12

Chris M. wrote:

On 12/16/05, Hal F. removed_email_address@domain.invalid wrote:

What’s the magic to get this going on Debian?

Assuming you’re using Ruby 1.8 you need to

apt-get install libruby1.8

But ruby already lists libruby1.8 as a dependency, so that shouldn’t be
the problem. It should already have been installed when ruby was
installed.

For Rails, I ALWAYS use rubygems to install it. I’ve never had luck
with the debian packages.

Yes, well, let’s not reopen the RubyGems vs APT discussion again…
That’s one area where the Debian folk deserve criticism, but they don’t
seem to have any interest in cooperating to fix the problem.

So yeah, the best thing is to install RubyGems from source and use it
for all Ruby libraries. Or as you say:

As silly as this sounds, I typically install gems via gem (rubygems)
and anything that starts with lib via apt. :wink:

mathew


#13

Hello.

Chris M.:

I haven’t seen a rubygem package for debian since 8.4,

Hyspro seems to have 0.8.11 - see the end of
http://pkg-ruby-extras.alioth.debian.org/rubygems.html

which can still be used if you do the following

gem install rubygems-update

AND

update_rubygems

What is the purpose of this? Does this keep the rubygems updated
‘the Debian way’, i.e. dpkg knows about any added/removed files?

Although it’s just as easy to install rubygems
from source, and lately I’ve just been doing that.

Right, but if you don’t put it in /opt, you’re polluting the
dpkg’s file hierarchy. You could at least checkinstall -D.

For Rails, I ALWAYS use rubygems to install it.
I’ve never had luck with the debian packages.

Hm, the rails Debian package always worked for me as a charm.

Obviously it’s kind of a try and see type
of thing, there really is no “right way”.
As silly as this sounds, I typically install gems via
gem (rubygems) and anything that starts with lib via apt. :wink:

I try to install anything I can via apt, so as to minimise the
filesystem pollution and to have other Debian packages that might
depend on a given thing have it fulfilled without duplications.

I was wondering whether anyone tried
checkinstall -D gem install ...

  • does this work/makes sense?

Cheers,
– Shot


#14

Esteban Manchado Velázquez wrote:

If he's indeed using stable, you'll have to install a couple of packages

to have a complete Ruby installation.

Specifically:

ruby
ri1.8
rdoc1.8

The latter two are suggested by APT when you install the first.

mathew


#15

On 12/21/05, mathew removed_email_address@domain.invalid wrote:

As silly as this sounds, I typically install gems via gem (rubygems)
and anything that starts with lib via apt. :wink:

mathew

  <URL:http://www.pobox.com/~meta/>

My parents went to the lost kingdom of Hyrule
and all I got was this lousy triforce.

Is there an easy way for Debian users to create .debs for stuff
otherwise installed via gems or with setup.rb? I regularly create
.debs for “./configure; make; make install” by using checkinstall, but
am unaware of the ruby equivalent, if any. I’d heard that it’s out
there, but haven’t seen it in my googling.

Thanks,

– AL –


#16

On Fri, Dec 23, 2005 at 10:32:50PM +0900, Hans Fugal wrote:

It’s called equivs, and I’ve never used it but I know you can do it.
Try that for a google keyword.

equivs is for creating (mostly) empty .deb packages, for testing 

purposes
or to work-around dependency problems.

There isn't (yet) a way to create a .deb package from a Ruby Gem or 

a
setup.rb-ridden Ruby tarball, but we’re working on it (specially the
second).

Regards,

#17

It’s called equivs, and I’ve never used it but I know you can do it.
Try that for a google keyword.


#18

Hello.

mathew:

Yes, well, let’s not reopen the RubyGems vs APT discussion again…
That’s one area where the Debian folk deserve criticism, but they
don’t seem to have any interest in cooperating to fix the problem.

Don’t you think that following ‘let’s not reopen’ with ‘Debian folk
deserve criticism’ and ‘don’t seem to have any interest in cooperating’
seems a bit contradictory?

Al Gordon:

Is there an easy way for Debian users to create .debs for stuff
otherwise installed via gems or with setup.rb? I regularly create
.debs for “./configure; make; make install” by using checkinstall,
but am unaware of the ruby equivalent, if any.

Don’t checkinstall gem install ...
and checkinstall ruby setup.rb work?

(Not tried these, just wondering.)

Cheers,
– Shot (who believes that Debian folks are right in trying to follow
FHS)


#19

On Sat, Dec 24, 2005 at 07:39:46AM +0900, Shot - Piotr S. wrote:
} Hello.
}
} mathew:
}
} > Yes, well, let’s not reopen the RubyGems vs APT discussion again…
} > That’s one area where the Debian folk deserve criticism, but they
} > don’t seem to have any interest in cooperating to fix the problem.
}
} Don’t you think that following ‘let’s not reopen’ with ‘Debian folk
} deserve criticism’ and ‘don’t seem to have any interest in
cooperating’
} seems a bit contradictory?
}
} Al Gordon:
}
} > Is there an easy way for Debian users to create .debs for stuff
} > otherwise installed via gems or with setup.rb? I regularly create
} > .debs for “./configure; make; make install” by using checkinstall,
} > but am unaware of the ruby equivalent, if any.
}
} Don’t checkinstall gem install ...
} and checkinstall ruby setup.rb work?
}
} (Not tried these, just wondering.)

I haven’t tried either of these, but I’ve been happy with a /usr/local
install of gem on Debian. It took some work to figure out how to get it
to
work right, but I documented it at
http://rubyforge.org/tracker/index.php?func=detail&aid=1198&group_id=126&atid=575
so other people can deal with it themselves. To deal with the GEM_HOME
environment variable issue I added the following line to /etc/csh.cshrc:

setenv GEM_HOME “/usr/local/lib/site_ruby/gems”

…and the following line to /etc/profile:

export GEM_HOME="/usr/local/lib/site_ruby/gems"

I also symlinked /usr/local/lib/site_ruby/gems/bin to /usr/local/bin for
convenience.

While it would be nice if Debian magically played nice with RubyGems,
I’m
more annoyed that it took a moderately complicated workaround to get gem
to
install in /usr/local properly, like any well-behaved piece of OSS
would.

} Cheers,
} – Shot (who believes that Debian folks are right in trying to follow
FHS)
–Greg


#20

Hello.

mathew:

Esteban Manchado Velázquez wrote:

If he’s indeed using stable, you’ll have to install
a couple of packages to have a complete Ruby installation.

Specifically:

ruby
ri1.8
rdoc1.8

Or, better yet, ri and rdoc (dummy packages depending on the latest ri
and RDoc versions, just like the ruby one depends on the latest Ruby)

  • this way you’ll get automagically upgraded to 2.0 if/when the next
    Debian stable ships it.

Cheers,
– Shot