Zabbix-2.2.1 build server-side custom rpm method [memo]

Source: Internet
Author: User
Tags snmp

Zabbix-2.2.1 download location
Http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.1/zabbix-2.2.1.tar.gz

Objective: To create a zabbix server RPM package for convenient software distribution
Installation path:

Application:/apps/svr/zabbix configuration file:/apps/conf library file:/apps/lib header file:/apps/include Startup Program:/apps/shweb management: /apps/dat/web/zabbix

Compilation Test
Install required library files

[root@localhost zabbix-2.2.1]# yum install -y net-snmp*  curl-devel mysql-develDependency Installed:  beecrypt.x86_64 0:4.1.2-10.1.1                                    beecrypt-devel.x86_64 0:4.1.2-10.1.1  curl.i386 0:7.15.5-15.el5                                         elfutils-devel.x86_64 0:0.137-3.el5  elfutils-devel-static.x86_64 0:0.137-3.el5                        elfutils-libelf-devel.x86_64 0:0.137-3.el5  elfutils-libelf-devel-static.x86_64 0:0.137-3.el5                 libidn.i386 0:0.6.5-1.1  libidn-devel.x86_64 0:0.6.5-1.1                                   lm_sensors.x86_64 0:2.10.7-9.el5  lm_sensors-devel.x86_64 0:2.10.7-9.el5                            nspr-devel.x86_64 0:4.8.8-2.el5  nss-devel.x86_64 0:3.12.10-8.el5                                  rpm-devel.x86_64 0:4.4.2.3-27.el5Complete!

Decompress zabbix Server

[root@localhost src]# tar xf /root/zabbix-2.2.1.tar.gz  -C /usr/src[root@localhost src]# cd /usr/src/zabbix-2.2.1/ 

Test

./configure --enable-server --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2=/apps/lib/libxml2-2.7.8/bin/xml2-config   --with-iconv=/apps/lib/libiconv-1.14  Enable server:         yes  Server details:    With database:         MySQL    WEB Monitoring:        yes    Native Jabber:         no    SNMP:                  yes    IPMI:                  no    SSH:                   no    ODBC:                  no    Linker flags:          -rdynamic  -L//apps/lib/libiconv-1.14/lib    -L/apps/svr/mysql5/lib      -L/apps/lib/libxml2-2.7.8/lib  -L/usr/kerberos/lib64   -L/usr/lib64 -L/usr/lib64 -L/usr/lib64/lib    Libraries:             -lm -ldl -lrt  -lresolv -liconv   -lmysqlclient      -lxml2   -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz   -lnetsnmp -lcrypto -lm -lwrap -lcrypto  Enable proxy:          no  Enable agent:          no  Enable Java gateway:   no  LDAP support:          no  IPv6 support:          no************************************************************            Now run 'make install'                       **                                                         **            Thank you for using Zabbix!                  **              

Exit compilation after make is successful

Create an RPM package. rhel5.8 is currently used.
File description

Spec files are used to define compilation and RPM creation information, which are stored in/usr/src/redhat/SPECS/zabbix-2.2.1.specsource files by default to compile and generate RPM files, default needs to be stored to/usr/src/redhat/SOURCES/zabbix-2.2.1.tar.gz

Default spec template and simple description
Name: package Name Version: Version Release: 1% {? Dist} distribution version Summary: Summary Group: rpm Group definition. For details, refer to the/usr/share/doc/rpm-4.4.2.3/GROUPS file to obtain related information. License: License URL: software-related URLSource0: source code location BuildRoot: % {_ tmppath}/% {name}-% {version}-% {release}-root-% (% {__ id_u}-n) buildRequires: the required software package depends on Requires: the software package required for installation depends on the software package description related to % description % prep the script executed before compilation % setup-q % build % configure. The software package compilation parameter make % {? _ Smp_mflags} compile % installrm-rf % {buildroot} Delete the compiled junk file make install DESTDIR =%{ buildroot} install location definition % cleanrm-rf % {buildroot} create RPM package after, delete the compiled and installed software % files % defattr (-, root, root,-) and define the file attributes during RPM installation. % doc document description % changelog brief information about the current RPM

Below is the edited zabbix-2.2.1.spec

Name: zabbixVersion: 2.2.1Release:        20140121.vipclound.el5Summary:  use for monitor openstack VM.Group: Applications/SystemLicense: PSFURL: http://www.zabbix.com/download.phpSource0: http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.1/zabbix-2.2.1.tar.gzBuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)BuildRequires: autoconfBuildRequires: bzip2BuildRequires: bzip2-develBuildRequires: db4-develBuildRequires: expat-develBuildRequires: findutilsBuildRequires: gcc-c++BuildRequires: glibc-develBuildRequires: makeBuildRequires: openssl-develBuildRequires: pkgconfigBuildRequires: readline-develBuildRequires: sqlite-develBuildRequires: tarBuildRequires: zlib-develRequires: curlRequires: curl-develRequires: nss-develRequires: nspr-develRequires: elfutils-develRequires: beecrypt-develRequires: net-snmp-develRequires: mysql-devel######## DEFINE LOCATION#######%define _prefix                 /apps%define _exec-prefix            /apps%define _bindir                 /apps/svr/zabbix/bin%define _sbindir                /apps/svr/zabbix/sbin%define _sysconfdir             /apps/conf%define _includedir             /apps/include%define _libexecdir             /apps/lib%define _infodir                /apps/info%define _oldincludedir          /apps/include%define _libdir                 /apps/lib%define _defaultdocdir          /apps/man%define _mandir                 /apps/man%descriptionZabbix is the ultimate enterprise-level software designed for monitoring availability and performance of IT infrastructure components. Zabbix is open source and comes at no cost.%prep%setup -q%build%configure --enable-server --enable-proxy --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2=/apps/lib/libxml2-2.7.8/bin/xml2-config   --with-iconv=/apps/lib/libiconv-1.14make %{?_smp_mflags}%installrm -rf %{buildroot}make install DESTDIR=%{buildroot}mkdir   %{buildroot}/apps/conf/zabbix -pcp  $RPM_BUILD_DIR/zabbix-2.2.1/database/mysql/schema.sql %{buildroot}/apps/conf/zabbix/schema.sqlcp  $RPM_BUILD_DIR/zabbix-2.2.1/database/mysql/images.sql %{buildroot}/apps/conf/zabbix/images.sqlcp  $RPM_BUILD_DIR/zabbix-2.2.1/database/mysql/data.sql %{buildroot}/apps/conf/zabbix/data.sqlmkdir %{buildroot}/apps/dat/web/zabbix -pmkdir %{buildroot}/apps/sh/ -pcp -rp $RPM_BUILD_DIR/zabbix-2.2.1/frontends/php/* %{buildroot}/apps/dat/web/zabbix/.cp $RPM_BUILD_DIR/zabbix-2.2.1/misc/init.d/fedora/core/zabbix_server %{buildroot}/apps/sh/zabbix_server%cleanrm -rf %{buildroot}%files%defattr(-,root,root,-)%{_sysconfdir}/zabbix_server.conf%{_mandir}/man8/zabbix_server.8%{_sbindir}/zabbix_server%{_sysconfdir}/zabbix_proxy.conf%{_mandir}/man8/zabbix_proxy.8%{_sbindir}/zabbix_proxy%config(noreplace) /apps/conf/zabbix/schema.sql%config(noreplace) /apps/conf/zabbix/images.sql%config(noreplace) /apps/conf/zabbix/data.sql%config(noreplace) /apps/dat/web/*%config(noreplace) /apps/sh/zabbix_server%doc%changelog* Wed Jan 22 2014 terrytsang  <signmem@hotmail.com>-- example

Note: The current library dependency uses the custom libxml2-devel and iconv-devel, you can re-define, in addition, the current does not need to monitor the JAVA service, therefore, the -- enable-java parameter is not used.

Compilation Method

[root@localhost SPECS]# rpmbuild  -bb zabbix-2.2.1.spec

Pay attention to the final compilation Information

Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/zabbix-2.2.1-20140121.vipclound.el5-A16601Wrote: /usr/src/redhat/RPMS/x86_64/zabbix-2.2.1-20140121.vipclound.el5.x86_64.rpmWrote: /usr/src/redhat/RPMS/x86_64/zabbix-debuginfo-2.2.1-20140121.vipclound.el5.x86_64.rpmExecuting(%clean): /bin/sh -e /var/tmp/rpm-tmp.94541+ umask 022+ cd /usr/src/redhat/BUILD+ cd zabbix-2.2.1+ rm -rf /var/tmp/zabbix-2.2.1-20140121.vipclound.el5-A16601+ exit 0

After the software is compiled, it is generated in the/usr/src/redhat/RPMS directory by default.

Wrote: /usr/src/redhat/RPMS/x86_64/zabbix-2.2.1-20140121.vipclound.el5.x86_64.rpmWrote: /usr/src/redhat/RPMS/x86_64/zabbix-debuginfo-2.2.1-20140121.vipclound.el5.x86_64.rpm

Test Software Installation

[root@localhost SPECS]# rpm -ivh /usr/src/redhat/RPMS/x86_64/zabbix-2.2.1-20140121.vipclound.el5.x86_64.rpmPreparing...                ########################################### [100%]   1:zabbix                 ########################################### [100%]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.