パンダのメモ帳

技術系のネタをゆるゆると

CentOS 6.3 に checkinstall をインストールする

64bit版 CentOS 6.3 に checkinstall をインストールする。

要点

  • 64bit版 CentOS 6.3 では、2012年12月19日現在の最新版 1.6.2 をダウンロードして make しようとしてもエラーで失敗する。
  • 公開されている git リポジトリから最新版を clone して一部を修正し、コンパイル → インストールする。

依存パッケージをインストール

checkinstall をコンパイル・実行するためには gettext をインストールする必要がある。

[user@localhost ~]$ sudo yum install gettext rpm-build

ソースコードを入手 → 修正

http://checkinstall.izto.org/ で公開されている git リポジトリから ソースコード一式を入手しファイルを修正する。

[user@localhost ~]$ cd /usr/local/src
[user@localhost src]$ git clone http://checkinstall.izto.org/checkinstall.git
[user@localhost src]$ cd checkinstall
[user@localhost checkinstall]$ vi Makefile
[user@localhost checkinstall]$ vi checkinstallrc-dist
[user@localhost checkinstall]$ vi installwatch/Makefile

修正後の diff は次の通り。

[user@localhost checkinstall]# git diff
diff --git a/Makefile b/Makefile
index 2e28adc..b6d217c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 PREFIX=/usr/local
 BINDIR=$(PREFIX)/sbin
 LCDIR=$(PREFIX)/lib/checkinstall/locale
-CONFDIR=$(PREFIX)/lib/checkinstall
+CONFDIR=$(PREFIX)

 all:
        for file in locale/checkinstall-*.po ; do \
diff --git a/checkinstallrc-dist b/checkinstallrc-dist
index d4feb4e..fe5f56e 100644
--- a/checkinstallrc-dist
+++ b/checkinstallrc-dist
@@ -117,7 +117,7 @@ RESET_UIDS=0
 NEW_SLACK=1

 # Comma delimited list of files/directories to be ignored
-EXCLUDE=""
+EXCLUDE="/selinux"

 # Accept default values for all questions?
 ACCEPT_DEFAULT=0
diff --git a/installwatch/Makefile b/installwatch/Makefile
index ae34fc1..fb41eb3 100644
--- a/installwatch/Makefile
+++ b/installwatch/Makefile
@@ -11,7 +11,7 @@ PREFIX=/usr/local
 VERSION=0.7.0beta7

 BINDIR=$(PREFIX)/bin
-LIBDIR=$(PREFIX)/lib
+LIBDIR=$(PREFIX)/lib64

 all: installwatch.so

コンパイル → インストール

修正が完了したら make → make install でインストール。

[user@localhost ~]$ make
[user@localhost ~]$ sudo make install

実行

まずは checkinstall 自体を rpm 化して上書きインストールする。 /root/rpmbuild/SOURCES というディレクトリが必要になるので先に作成しておく。

[root@localhost ~]# mkdir -p ~/rpmbuild/SOURCES
[root@localhost ~]# cd /usr/local/src/checkinstall
[root@localhost checkinstall]# checkinstall

いくつか入力を求められるので入力していくと次のような結果が表示される。

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

 Done. The new package has been saved to

 /root/rpmbuild/RPMS/x86_64/checkinstall-20121220-1.x86_64.rpm
 You can install it in your system anytime using: 

      rpm -i checkinstall-20121220-1.x86_64.rpm

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

生成された rpm をインストール&確認する。

[root@localhost ~]# rpm -ivh /root/rpmbuild/RPMS/x86_64/checkinstall-20121220-1.x86_64.rpm
準備中...                ########################################### [100%]
   1:checkinstall           ########################################### [100%]
[root@localhost ~]# rpm -qi checkinstall
rpm -qi checkinstall
Name        : checkinstall                 Relocations: (not relocatable)
Version     : 20121220                          Vendor: (none)
Release     : 1                             Build Date: 2012年12月20日 00時04分10秒
Install Date: 2012年12月20日 00時09分59秒      Build Host: localhost
Group       : Applications/System           Source RPM: checkinstall-20121220-1.src.rpm
Size        : 453050                           License: GPL
Signature   : (none)
Packager    : checkinstall-1.6.3
Summary     : CheckInstall installations tracker, version 1.6.2
Description :
CheckInstall installations tracker, version 1.6.2

CheckInstall  keeps  track of all the files created  or
modified  by your installation  script  ("make install"
"make install_modules",  "setup",   etc),   builds    a
standard   binary   package and  installs  it  in  your
system giving you the ability to uninstall it with your
distribution's  standard package management  utilities.

参考