install ruby on debian again

以前 http://d.hatena.ne.jp/akm/20060828 で「ruby 1.8.4 を unstableなdeb-srcからゲット」としてdeb-srcからrubyをインストールする方法を書いたけど、そんなことできればやめて普通にapt-getしたいので、改めてrubyのインストールを書いてみます。

本当のところは、昨日インストールしなおしたDebianSubversionを復旧したあと、CIAのことを考えたらやっぱりインストールしたくなってきて、そしたらRubyもインストールする必要があったと。CIAを使うので1.8.2じゃ意味がないので、1.8.5をインストールするっす。

まずおさらい。/etc/apt/sources.list にunstableなパッケージをゲットする先のapt-lineを追加してあるかな?

deb http://ftp.jp.debian.org/debian/ unstable main
deb-src http://ftp.jp.debian.org/debian/ unstable main

次は必須じゃないけど、基本stableしか使わないよってするための設定。/etc/apt/apt.conf.d/にある設定ファイル。僕のは70debconfだった。なんでこんな名前なのかはよく分からないけど。

APT::Default-Release "stable";

これが追加されてなかったら追加しておこう。これで準備完了。


まずはインストールするものを探そう。apt-cacheであたりを付けよう。

$ apt-cache search ruby1.8.5
$ apt-cache search ruby1.8.5
libamstd-ruby1.8 - AMbitious STanDard library for Ruby 1.8
libbsearch-ruby - a binary search library for Ruby
・・・
mahoro-ruby1.8 - File type determination library for Ruby 1.8
ruby1.8 - Interpreter of object-oriented scripting language Ruby 1.8
ruby1.8-dev - Header files for compiling extension modules for the Ruby 1.8
ruby1.8-elisp - ruby-mode for Emacsen
ruby1.8-examples - Examples for Ruby 1.8
soap4r - SOAP1.1 implementation in ruby
$ 

"ruby1.8.5"じゃ何もヒットしなかったけど、"ruby1.8"だとたくさんヒットしすぎ。でも一覧の最後のほうにruby1.8とかいうのがあるので詳しく調べよう。

$ apt-cache show ruby1.8
Package: ruby1.8
Priority: optional
Section: interpreters
Installed-Size: 296
Maintainer: akira yamada <akira@debian.org>
Architecture: i386
Version: 1.8.5-4
Depends: libc6 (>= 2.3.6-6), libruby1.8 (>= 1.8.5)
Suggests: ruby1.8-examples, rdoc1.8, ri1.8
Filename: pool/main/r/ruby1.8/ruby1.8_1.8.5-4_i386.deb
Size: 216910
MD5sum: a779d41afaab2856794526ee7c7a8204
SHA1: 16295e66ba04c4a31d9466f1d8ac5132c8bfadaf
SHA256: b7b3a565f4b688d2d3ca7f53b5188d72a4df90eaeae11a9832fc8de19be89da3
Description: Interpreter of object-oriented scripting language Ruby 1.8
 Ruby is the interpreted scripting language for quick and easy
 object-oriented programming.  It has many features to process text
 files and to do system management tasks (as in perl).  It is simple,
 straight-forward, and extensible.
 .
 This package provides version 1.8 series of Ruby.
 .
 On Debian, Ruby 1.8 is provided as separate packages.  You can get
 full Ruby 1.8 distribution by installing following packages.
 .
   ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp
   ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8
   libopenssl-ruby1.8 libreadline-ruby1.8
Tag: devel::{interpreter,lang:ruby,runtime}, implemented-in::ruby, interface::commandline, role::program, scope::utility, works-with::software:source

Package: ruby1.8
Priority: optional
Section: interpreters
Installed-Size: 244
Maintainer: akira yamada <akira@debian.org>
Architecture: i386
Version: 1.8.2-7sarge5
Depends: libc6 (>= 2.3.2.ds1-21), libruby1.8 (>= 1.8.2-7sarge5)
Suggests: ruby1.8-examples, rdoc1.8, ri1.8
Filename: pool/updates/main/r/ruby1.8/ruby1.8_1.8.2-7sarge5_i386.deb
Size: 151662
MD5sum: 5feafa4bbbcc724ee26d79fe7ff30f3f
SHA1: a77d3158380518126ec6639c9482f40a13673b3d
SHA256: 7f96acebe1263c0c11397d4fe9df7d5687619968e63c19423399eeee0c042d8a
Description: Interpreter of object-oriented scripting language Ruby 1.8
 Ruby is the interpreted scripting language for quick and easy
 object-oriented programming.  It has many features to process text
 files and to do system management tasks (as in perl).  It is simple,
 straight-forward, and extensible.
 .
 This package provides version 1.8 series of Ruby.

Package: ruby1.8
Priority: optional
Section: interpreters
Installed-Size: 244
Maintainer: akira yamada <akira@debian.org>
Architecture: i386
Version: 1.8.2-7sarge4
Depends: libc6 (>= 2.3.2.ds1-21), libruby1.8 (>= 1.8.2-7sarge4)
Suggests: ruby1.8-examples, rdoc1.8, ri1.8
Filename: pool/main/r/ruby1.8/ruby1.8_1.8.2-7sarge4_i386.deb
Size: 151532
MD5sum: 3beddf1ae51a2725f8bf1877da2a4dba
SHA1: 86307557b3caae643b94530e4eefe04cd4e33c29
SHA256: 5c33d273ade5b887f0cc7ef45ebe85f86426c0af0592e1469bbd40693eb1f9de
Description: Interpreter of object-oriented scripting language Ruby 1.8
 Ruby is the interpreted scripting language for quick and easy
 object-oriented programming.  It has many features to process text
 files and to do system management tasks (as in perl).  It is simple,
 straight-forward, and extensible.
 .
 This package provides version 1.8 series of Ruby.

3つのruby1.8パッケージが表示された。Versionを見ると1.8.5-4、1.8.2-7sarge5、1.8.2-7sarge4と微妙に違う。sarge4とsarge5ってのはdebianのバージョンなので、こういう風に出るっぽい。とりあえずapt-get installしてみたり。でも闇雲にインストールするのは不安なので-sオプションを付けて試してみる。これを付けると、実際のインストールは実行されません。

# apt-get -s install ruby1.8
パッケージリストを読みこんでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
  libruby1.8
提案パッケージ:
  ruby1.8-examples rdoc1.8 ri1.8
以下のパッケージが新たにインストールされます:
  libruby1.8 ruby1.8
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。
Inst libruby1.8 (1.8.2-7sarge5 Debian-Security:3.1/stable)
Inst ruby1.8 (1.8.2-7sarge5 Debian-Security:3.1/stable)
Conf libruby1.8 (1.8.2-7sarge5 Debian-Security:3.1/stable)
Conf ruby1.8 (1.8.2-7sarge5 Debian-Security:3.1/stable)

1.8.5をインストールしたいのに、1.8.2とか書かれてるんですけど?
いや、これでいいのです。最初の方の設定でunstableなapt-lineを追加して /etc/apt/apt.conf.d/70debconfに APT::Default-Release "stable"; って設定した。

もし、APT::Default-Release を設定してなかったら、とにかくstableとかunstableとか関係なしに最新のパッケージをインストールしようとしちゃうので、結構危険なわけです。それを「特別な指定がなければstableしか使わんよ」としてくれる設定がAPT::Default-Releaseなのですね。んで、さっきのapt-get install ではその特別な指定をしてなかったのでstableのパッケージが選ばれたっていう寸法です。

ではその特別な指定をして再度。

# apt-get install -s -t unstable ruby1.8
パッケージリストを読みこんでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
  libc6 libc6-dev libncurses5 libruby1.8 locales tzdata
提案パッケージ:
  glibc-doc ruby1.8-examples rdoc1.8 ri1.8
以下のパッケージは「削除」されます:
  base-config initrd-tools kernel-image-2.4.27-2-386
以下のパッケージが新たにインストールされます:
  libruby1.8 ruby1.8 tzdata
以下のパッケージはアップグレードされます:
  libc6 libc6-dev libncurses5 locales
アップグレード: 4 個、新規インストール: 3 個、削除: 3 個、保留: 232 個。
Remv base-config (2.53.10.2 Debian:3.1r4/stable)
Remv kernel-image-2.4.27-2-386 (2.4.27-10sarge1 Debian:3.1r4/stable, Debian-Security:3.1/stable)
Remv initrd-tools (0.1.81.1 Debian:3.1r4/stable)
Inst tzdata (2006p-1 Debian:unstable)
Inst libc6-dev [2.3.2.ds1-22sarge4] (2.3.6.ds1-10 Debian:unstable) []
Inst locales [2.3.2.ds1-22sarge4] (2.3.6.ds1-10 Debian:unstable) []
Inst libc6 [2.3.2.ds1-22sarge4] (2.3.6.ds1-10 Debian:unstable)
Conf tzdata (2006p-1 Debian:unstable)
Conf libc6 (2.3.6.ds1-10 Debian:unstable)
Inst libncurses5 [5.4-4] (5.5-5 Debian:unstable)
Conf libncurses5 (5.5-5 Debian:unstable)
Inst libruby1.8 (1.8.5-4 Debian:unstable)
Inst ruby1.8 (1.8.5-4 Debian:unstable)
Conf libc6-dev (2.3.6.ds1-10 Debian:unstable)
Conf locales (2.3.6.ds1-10 Debian:unstable)
Conf libruby1.8 (1.8.5-4 Debian:unstable)
Conf ruby1.8 (1.8.5-4 Debian:unstable)

1.8.5-4という期待してたパッケージがインストールされるみたいですね。


・・・ちょっと待てーい

Remv kernel-image-2.4.27-2-386 (2.4.27-10sarge1 Debian:3.1r4/stable, Debian-Security:3.1/stable)

ってどういうこっちゃねーん。