CentOS 5.2を用いた実験環境で、バージョン1.8.6以上のrubyをインストールする必要に迫られた。
現時点で、CentOS 5.2に提供されているrubyは1.8.5。よい機会なのでパッケージを作ることにした。初挑戦。
はじめにtarボール(ruby-1.8.6.tar.gz)を入手
Ruby 1.8.6 リリース
このソースファイルからパッケージを生成する。
まずは展開してmake。
$ gtar xvzf ./ruby-1.8.6.tar.gz
:
$ cd ruby-1.8.6
$ ./configure --prefix=/usr
:
$ make
:
SRPMファイルのないtarボールからパッケージを生成する場合はcheckinstallを用いるのが楽であるよう。
ソースファイルからRPMファイルを作成するには
!!!checkinstallがインストールされていない。
じゃあ、と、yumでインストールしようとしたらNothing to doだ。
CentOS4.5にRPM作成ツール(checkinstall)のインストール
記述によれば、yumに--enablerepo=rpmforgeオプションを与えているけど、これは?
CentOS 5 で DAG(rpmforge) の yum repository 追加
DAG(rpmforge) は redhat 及び fedora 向けの追加パッケージ群です。
わかった。
手引きどおりに、DAGからRedhat5のrpmforge(rpmforge-release-0.3.6-1.el5.rf.i386.rpm)を入手してインストール。
DAG
$ wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
$ su
# rpm -hiv rpmforge-release-0.3.6-1.el5.rf.i386.rpm
インストール完了したら設定ファイルの書き換えを行う。
# vi /etc/yum.repos.d/rpmforge.repo
enabled を 0 に設定(初期値1)。
こうすることで、yumコマンドに--enablerepo=rpmforgeオプションを付けたときだけ、rpmforgeを見に行くようになる。
現時点の差分は以下。だいぶ違う。
# yum list | wc -l
5876
# yum list --enablerepo=rpmforge | wc -l
9239
で、checkinstallをインストール。
# yum --enablerepo=rpmforge install checkinstall
:
Installed: checkinstall.i386 0:1.6.0-3.el5.rf
Complete!
よし。
いよいよパッケージ生成。
Ruby1.8.7のインストール
checkinstallを使ってRPM化していきます。rubyのようなインストールしながら
ファイルをチェックして進んでいくタイプの場合には"-fstrans=no"をつけてあげる必要があります。
なるほど。
$ su
# checkinstall --fstrans=no
checkinstall 1.6.0, Copyright 2002 Felipe Eduardo Sanchez Diaz Duran
This software is released under the GNU GPL.
The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]:
Preparing package documentation...OK
Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R
**************************************
**** RPM package creation selected ***
**************************************
This package will be built according to these values:
1 - Summary: [ Package created with checkinstall 1.6.0 ]
2 - Name: [ ruby ]
3 - Version: [ 1.8.6 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ ruby-1.8.6 ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ ruby ]
Enter a number to change any of them or press ENTER to continue:
Installing with make install...
========================= Installation results ===========================
./miniruby ./instruby.rb --dest-dir="" --extout=".ext" --make="make" --mflags="" --make-flags="" --installed-list .installed.list --mantype="doc"
installing binary commands
installing command scripts
installing library scripts
installing headers
installing manpages
installing extension objects
installing extension scripts
======================== Installation successful ==========================
Copying documentation directory...
./
./doc/
./doc/irb/
./doc/irb/irb.rd.ja
./doc/irb/irb-tools.rd.ja
./doc/irb/irb.rd
./doc/NEWS-1.8.0
./doc/shell.rd.ja
./doc/forwardable.rd.ja
./doc/forwardable.rd
./doc/ChangeLog-1.8.0
./doc/shell.rd
./COPYING.ja
./GPL
./README.EXT
./NEWS
./README
./README.EXT.ja
./ChangeLog
./COPYING
./README.ja
Some of the files created by the installation are inside the build
directory: /home/hoge/rpm/ruby-1.8.6
You probably don't want them to be included in the package,
especially if they are inside your home directory.
Do you want me to list them? [n]:
Should I exclude them from the package? (Saying yes is a good idea) [y]:
Copying files to the temporary directory...OK
Striping ELF binaries and libraries...OK
Compressing man pages...OK
Building file list...OK
Building RPM package...OK
NOTE: The package will not be installed
Erasing temporary files...OK
Writing backup package...OK
Deleting temp dir...OK
**********************************************************************
Done. The new package has been saved to
/usr/src/redhat/RPMS/i386/ruby-1.8.6-1.i386.rpm
You can install it in your system anytime using:
rpm -i ruby-1.8.6-1.i386.rpm
**********************************************************************
できた。
今回は初めての事だったので、準備作業に手間取ったがパッケージ生成事態はそれほど難しくはなかった。次回はもっとうまくできそうだ。
なお今回、色々と調べている中で以下設定を行った。結果として本題に関与しないが備忘録として残しておく。一般ユーザでcheckinstall出来ると思ったのだ(出来る?)。
オレオレrpmパッケージの作り方(基本編)
$ mkdir -p ~/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
$ echo "%_topdir /home/hoge/rpm" > ~/.rpmmacros

コメントする