【checkinstall】
源码打包成rpm,工具有2个,一个是checkinstall,另外一个是fpm,这2个工具的大前提都得装rpm-build
不过注意CentOS5和CentOS6之间的rpm包不能混用,因为他们之间的glibc版本不同,动态库链接不上。
yum -y install rpm-build
先说说【checkinstall】
wget http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz
tar -xf checkinstall-1.6.2.tar.gz
make && make install
echo "/usr/local/lib64" >/etc/ld.so.conf.d/installwatch.conf
ldconfig
ln -s /usr/local/lib/installwatch.so /usr/local/lib64/installwatch.so
【
The following error can occur on 64 bit systems when trying to use the checkinstall program:
ERROR: ld.so: object ‘/usr/local/lib64/installwatch.so’ from LD_PRELOAD cannot be preloaded: ignored.
The problem occurs because the loader can’t find the shared object file. The solution is very simple. Assuming that the installwatch.so is located in /usr/local/lib, just type the following commands:
】
咱们以前安装源码包的时候 都是 ./confugure 一堆参数 然后 make 最后make install 这样的流程
如果用checkinstall 这个工具后 安装一个软件后 不需要最后的make install 了 前2步搞完了 直接 用checkinstall 来搞就行
例如安装php
./configure --prefix=/usr/local/php &&make后直接运行checkinstall
[root@client php-5.3.5]# checkinstall
checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
This software is released under the GNU GPL.
The checkinstallrc file was not found at:
/usr/local/sbin/../checkinstallrc
Assuming default values.
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
Please write a description for the package.
End your description with an empty line or EOF.
>> this is a php
>> --按个空格,然后再回车
**************************************
**** RPM package creation selected ***
**************************************
This package will be built according to these values:
1 - Summary: [ this is a php; ]
2 - Name: [ php ]
3 - Version: [ 5.3.5 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ x86_64 ]
8 - Source location: [ php-5.3.5 ]
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...
========================= Installation results ===========================
Installing PHP SAPI module: cgi
Installing PHP CGI binary: /usr/local/php/bin/
Installing PHP CLI binary: /usr/local/php/bin/
Installing PHP CLI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - already installed: 1.3.7
[PEAR] Console_Getopt - already installed: 1.2.3
[PEAR] Structures_Graph- already installed: 1.0.3
[PEAR] XML_Util - already installed: 1.2.1
[PEAR] PEAR - already installed: 1.9.1
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/php-5.3.5/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
======================== Installation successful ==========================
Copying documentation directory...
./
./INSTALL
./README.REDIST.BINS
./README.EXTENSIONS
./README.PHP4-TO-PHP5-THIN-CHANGES
./README.EXT_SKEL
./README.SELF-CONTAINED-EXTENSIONS
./README.WIN32-BUILD-SYSTEM
./README.Zeus
./README.RELEASE_PROCESS
./README.input_filter
./TODO
./LICENSE
./README.STREAMS
./README.TESTING
./README.TESTING2
./README.SUBMITTING_PATCH
./README.namespaces
./README.MAILINGLIST_RULES
./README.SVN-RULES
./README.PARAMETER_PARSING_API
./NEWS
./README.UNIX-BUILD-SYSTEM
./CREDITS
Copying files to the temporary directory...OK
Stripping ELF binaries...OK
Compressing man pages...OK
Building file list...OK
Building RPM package...OK
NOTE: The package will not be installed
Erasing temporary files...OK
Deleting doc-pak directory...OK
Writing backup package...OK
OK
Deleting temp dir...OK
**********************************************************************
Done. The new package has been saved to
/usr/src/redhat/RPMS/x86_64/php-5.3.5-1.x86_64.rpm
You can install it in your system anytime using:
rpm -i php-5.3.5-1.x86_64.rpm
**********************************************************************
然后把rpm拷贝到其他机器上
[root@master home]# rpm -ivh php-5.3.5-1.x86_64.rpm
Preparing... ########################################### [100%]
1:php ########################################### [100%]
[root@master php]# ll /usr/local/php/
total 20
drwxr-xr-x 2 root root 4096 Jul 12 13:38 bin
drwxr-xr-x 2 root root 4096 Jul 12 13:38 etc
drwxr-xr-x 3 root root 4096 Jul 12 13:38 include
drwxr-xr-x 3 root root 4096 Jul 12 13:38 lib
drwxr-xr-x 3 root root 4096 Jul 12 13:38 man
ok,大功告成