ソースファイルをrpm化する

ソースファイル(tarボール)からrpmファイルを作るときは
rpmbuildコマンドでもいいけど、SPECファイルがないとできないとかいろいろ制約がある。

rpm化するためには、もう一個checkinstallコマンドを使うやる方があるのでこっちでやってみた。

インストール

checkinstallはデフォのレポジトリでは入ってないかもしれない。
そんな時は↓のサイトを参考にDAGを入れた後にインストールする。

CentOS 5 で DAG(rpmforge) の yum repository 追加 - Enjoi Blog

(私の環境はCent5(32bitなので)
$ wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
$ sudo rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
$ yum search checkins
$ sudo yum install checkinstall.i386

これでインストールできました。

rpm化する

まぁ例なんでなんでもいいんですけど。
/usr/local/src配下にたまたまphp-5.3.2.tar.gzがあったんでこれでやってみる。


まず展開して

$ tar zxf php-5.3.2.tar.gz
$ cd php-5.3.2

configureまでやる。configureのオプション指定したい場合はここで指定。

$ ./configure
<略>

で無事configureが通ったらcheckinstallコマンドを打つ(root権限)。

$
$ sudo /usr/sbin/checkinstall

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]: y を入力

Preparing package documentation...OK

Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R を入力(rpmのRね)

Please write a description for the package.
End your description with an empty line or EOF.
>>

**************************************
**** RPM package creation selected ***
**************************************

This package will be built according to these values:

1 -  Summary: [ Package created with checkinstall 1.6.0 ]
2 -  Name:    [ php ]
3 -  Version: [ 5.3.2 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ php-5.3.2 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ php ]

Enter a number to change any of them or press ENTER to continue: (エンター)

Installing with make install...

<略(makeをしてる)>

**********************************************************************

 Done. The new package has been saved to

 /usr/src/redhat/RPMS/i386/php-5.3.2-1.i386.rpm
 You can install it in your system anytime using:

      rpm -i php-5.3.2-1.i386.rpm

**********************************************************************

はい。これで/usr/src/redhat/RPMS/i386/配下にrpmファイルができました。

$ ls -l /usr/src/redhat/RPMS/i386/*
-rw-r--r-- 1 root root 4820819  5月  4 20:26 /usr/src/redhat/RPMS/i386/php-5.3.2-1.i386.rpm

あとはこれをrpmコマンドでインストールだけです。