checkinstall诞生的背景
对于一些程序只有源码包,没有提供标准的二进制包(rpm或deb等),以后要卸载的时候,你只能记下所有由程序生成或修改的文件,最好手工删除它。checkinstall会跟踪install命令所创建或修改的所有文件的路径,并建立一个 Slackware-,Debian- 或RPM- 安装包,然后你可以用centos的yum或ubuntu的apt-get来卸载它了。
checkinstall安装
checkinstall rpm下载地址:
默认的centos源里面没有,epel源也没有。
从fio源码制作rpm包
[root@gluster2 ~]# ll fio-2.1.10 -d # 下载fio源码包,并解压 drwxrwxr-x 12 root root 4096 Oct 29 21:10 fio-2.1.10
传统的源码安装方式:./configure && make && make install
使用checkinstall的安装方式:./configure && make && checkinstall
checkinstall默认会运行make install,如果你的安装命令是setup.sh,这时候安装命令就要变成这样了:./configure && make && checkinstall setup.sh
[root@gluster2 ~]# cd fio-2.1.10 [root@gluster2 fio-2.1.10]# ./configure && make && checkinstall Should I create a default set of package docs? [y]: # 按回车即可 Please write a description for the package. # 输入对这个包的描述 End your description with an empty line or EOF. >> This package will be built according to these values: 1 - Summary: [ Package created with checkinstall 1.6.2 ] 2 - Name: [ fio ] 3 - Version: [ 2.1.10 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ Applications/System ] 7 - Architecture: [ x86_64 ] 8 - Source location: [ fio-2.1.10 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ fio ] Enter a number to change any of them or press ENTER to continue: # 回车继续 # 就这样fio的rpm有了,默认生成在/root/rpmbuild/RPMS/x86_64目录下,如果你的ubuntu,就会生成deb包,根据你平台来的 Done. The new package has been installed and saved to /root/rpmbuild/RPMS/x86_64/fio-2.1.10-1.x86_64.rpm You can remove it from your system anytime using: rpm -e fio-2.1.10-1
checkinstall常用选项
--pakdir=<directory> # 生成的rpm包存放目录
--pkgname=<name> # 生成的rpm包名
--pkgversion=<version> # 生成的rpm版本
参考链接
http://www.ibm.com/developerworks/cn/linux/l-cn-checkinstall/