天天看點

linux下使用checkinstall 制作zabbix的rpm包

目前,想要在所有的client端安裝zabbix client,因為想要指定預定義的路徑,通過zabbix資源制作rpm包,制作rpm包的方式有多種

一種是:rombuild的方式,主要是編寫spec的檔案

一種是:checkinstall 開源的

一種是:fpm,ruby寫的,也是開源的

學習通過checkinstall 的方式,制作rpm包

1.下載下傳安裝

wget http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.6.2.tar.gz && tar fxz checkinstall-1.6.2.tar.gz && cd checkinstall-1.6.2 && make && make install 安裝很簡單 這樣就OK了

安裝完後 我們這麼用呢 下面開始講下這麼用吧

咱們以前安裝源碼包的時候 都是 ./confugure 一堆參數 然後 make 最後make install 這樣的流程

如果用checkinstall 這個工具後 安裝一個軟體後 不需要最後的make install 了 前2步搞完了 直接 用checkinstall 來搞就行

下面我正好用個 zabbix 我就用這個來搞一片吧

提前需要:yum install net-snmp net-snmp-devel

                yum install libcurl-devel

cd zabbix-2.2.1

./configure –prefix=/usr/local/zabbix –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl && make

好 先搞完這2步驟 然後用 checkinstall 工具

[root@TEST01 zabbix-2.2.1]# checkinstall

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran

本軟體以 GNU GPL 版權協定頒布

The checkinstallrc file was not found at:

/usr/local/sbin/../checkinstallrc

假定是預設值。

The package documentation directory ./doc-pak does not exist.

Should I create a default set of package docs? [y]: y

準備軟體包的文檔……OK

請選擇你想使用的打包方式。

Slackware [S], RPM [R] 還是 Debian [D]?R

請為這個軟體包寫一個描述。

用一個空行或 EOF 來結束你的描述。

>> this is a zabbix install file

>>

軟體包将用下面的值來建立:

1 - Summary: [ this is a zabbix install file ]

2 - Name: [ zabbix ]

3 - Version: [ 2.2.1 ]

4 - Release: [ 1 ]

5 - License: [ GPL ]

6 - Group: [ Applications/System ]

7 - Architecture: [ x86_64 ]

8 - Source location: [ zabbix-2.2.1 ]

9 - Alternate source location: [ ]

10 - Requires: [ ]

11 - Provides: [ zabbix ]

輸入一個數字來改變它們,或按Enter鍵繼續: (這裡表示如果有需要去更改的地方

Installing with make install... 

如遇到錯誤:

ERROR: ld.so: object '/usr/local/lib64/installwatch.so' from LD_PRELOAD cannot be preloaded: ignored.

make[1]: Entering directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src'

Making install in libs

解決辦法:

echo "/usr/local/lib64" >/etc/ld.so.conf.d/installwatch.conf

ldconfig

ln -s /usr/local/lib/installwatch.so /usr/local/lib64/installwatch.so

如果正常的話,會有日志的輸出:

make[2]: Entering directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs'

Making install in zbxcrypto

make[3]: Entering directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs/zbxcrypto'

make[4]: Entering directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs/zbxcrypto'

make[4]: Nothing to be done for `install-exec-am'.

make[4]: Nothing to be done for `install-data-am'.

make[4]: Leaving directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs/zbxcrypto'

make[3]: Leaving directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs/zbxcrypto'

Making install in zbxcommon

make[3]: Entering directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs/zbxcommon'

make[4]: Entering directory `/tmp/checkinstall-1.6.2/zabbix-2.2.1/src/libs/zbxcommon'

=============================== 安裝成功 =================================

Copying documentation directory...

./

./NEWS

./INSTALL

./AUTHORS

./COPYING

./README

./ChangeLog

把檔案拷貝到臨時目錄……OK

Done. The new package has been saved to

/usr/src/redhat/RPMS/x86_64/zabbix-2.2.1-1.x86_64.rpm

You can install it in your system anytime using:

     rpm -i zabbix-2.2.1-1.x86_64.rpm

之後,到 /usr/src/redhat/RPMS/x86_64/路徑下,将生産的包scp到client端下,執行rpm進行安裝

scp zabbix-2.2.1-1.x86_64.rpm [email protected]:/tmp

client 端的安裝:

[root@puppet tmp]# rpm -ivh zabbix-2.2.1-1.x86_64.rpm

Preparing... ########################################### [100%]

  1:zabbix ########################################### [100%]

安裝路徑下的内容

/usr/local/zabbix

[root@puppet zabbix]# ls

bin etc sbin share

OK,這樣的制作方式就OK了

      本文轉自天真花語  51CTO部落格,原文連結:http://blog.51cto.com/caibird/1411203,如需轉載請自行聯系原作者

繼續閱讀