CentOS 7中编译zabbix3.2.1源码方法

1、首先下载zabbix的源码,地址为:http://www.zabbix.com/download,如下图所示:


2、在/usr/local/中新建一个zabbix文件夹,并将zabbix-3.2.1.tar.gz拷贝到该文件夹下,然后进入到该文件夹下并打开终端,如下图所示:


3、使用tar zxvf zabbix-3.2.1.tar.gz命令对源代码进行解压,如下图所示:



4、使用groupadd zabbix添加一个zabbix组,如下图所示:


5、使用useradd -g zabbix zabbix命令,在zabbix组中添加一个zabbix用户,如下图所示:


6、使用cd zabbix-3.2.1/进入到该目录,如下图所示:


7、可以通过./configure --help来查看帮助信息,如下所示:

`configure' configures Zabbix 3.2.1 to adapt to many kinds of systems.


Usage: ./configure [OPTION]... [VAR=VALUE]...


To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.


Defaults for the options are specified in brackets.


Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']


Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]


By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.


For better control, use the options below.


Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/zabbix]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]






  --psdir=DIR             ps documentation [DOCDIR]


Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names


System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]


Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --disable-silent-rules  verbose build output (undo: "make V=0")
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-dependency-tracking
                          speeds up one-time build
  --disable-largefile     omit support for large files
  --enable-static         Build statically linked binaries
  --enable-server         Turn on build of Zabbix server
  --enable-proxy          Turn on build of Zabbix proxy
  --enable-agent          Turn on build of Zabbix agent and client utilities
  --enable-java           Turn on build of Zabbix Java gateway
  --enable-ipv6           Turn on support of IPv6


Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-ibm-db2=[ARG]    use IBM DB2 CLI from given sqllib directory
                          (ARG=path); use /home/db2inst1/sqllib (ARG=yes);
                          disable IBM DB2 support (ARG=no)
  --with-ibm-db2-include=[DIR]
                          use IBM DB2 CLI headers from given path
  --with-ibm-db2-lib=[DIR]
                          use IBM DB2 CLI libraries from given path
  --with-mysql[=ARG]      use MySQL client library [default=no], optionally
                          specify path to mysql_config
  --with-oracle=[ARG]     use Oracle OCI API from given Oracle home
                          (ARG=path); use existing ORACLE_HOME (ARG=yes);
                          disable Oracle OCI support (ARG=no)
  --with-oracle-include=[DIR]
                          use Oracle OCI API headers from given path
  --with-oracle-lib=[DIR] use Oracle OCI API libraries from given path
  --with-postgresql[=ARG] use PostgreSQL library [default=no], optionally
                          specify path to pg_config
  --with-sqlite3[=ARG]    use SQLite 3 library [default=no], optionally
                          specify the prefix for sqlite3 library


If you want to use Jabber protocol for messaging:
  --with-jabber[=DIR]     Include Jabber support [default=no]. DIR is the
                          iksemel library install directory.


If you want to use XML library:
  --with-libxml2[=ARG]    use libxml2 client library [default=no], optionally
                          specify path to xml2-config


If you want to use unixODBC library:
  --with-unixodbc[=ARG]   use ODBC driver against unixODBC package
                          [default=no], optionally specify full path to
                          odbc_config binary.


If you want to use Net-SNMP library:
  --with-net-snmp[=ARG]   use Net-SNMP package [default=no], optionally
                          specify path to net-snmp-config


If you want to use SSH2 based checks:
  --with-ssh2[=DIR]       use SSH2 package [default=no], DIR is the SSH2
                          library install directory.


If you want to check IPMI devices:
  --with-openipmi[=DIR]   Include OPENIPMI support [default=no]. DIR is the
                          OPENIPMI base install directory, default is to
                          search through a number of common places for the
                          OPENIPMI files.


If you want to use encryption provided by mbed TLS (PolarSSL) library:
  --with-mbedtls[=DIR]    use mbed TLS (PolarSSL) package [default=no], DIR is
                          the libpolarssl install directory.


If you want to use encryption provided by GnuTLS library:
  --with-gnutls[=DIR]     use GnuTLS package [default=no], DIR is the
                          libgnutls install directory.


If you want to use encryption provided by OpenSSL library:
  --with-openssl[=DIR]    use OpenSSL package [default=no], DIR is the libssl
                          and libcrypto install directory.


If you want to check LDAP servers:
  --with-ldap[=DIR]       Include LDAP support [default=no]. DIR is the LDAP
                          base install directory, default is to search through
                          a number of common places for the LDAP files.


If you want to use cURL library:
  --with-libcurl[=DIR]    use cURL package [default=no], optionally specify
                          path to curl-config


If you want to specify iconv installation directories:
  --with-iconv=[DIR]      use iconv from given base install directory (DIR),
                          default is to search through a number of common
                          places for the iconv files.
  --with-iconv-include=[DIR]
                          use iconv include headers from given path.
  --with-iconv-lib=[DIR]  use iconv libraries from given path.


Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  IKSEMEL_CFLAGS
              C compiler flags for IKSEMEL, overriding pkg-config
  IKSEMEL_LIBS
              linker flags for IKSEMEL, overriding pkg-config


Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.


Report bugs to the package provider.

8、然后根据帮助信息组合城一条配置命令,如:

./configure --enable-server --enable-proxy --enable-agent --enable-java --enable-ipv6 --with-net-snmp --with-openipmi --with-mysql --with-libcurl --with-libxml2 --prefix=/usr/local/zabbix/bulid/ --datadir=/usr/local/zabbix/bulid/DataRootDir/ --htmldir=/usr/local/zabbix/bulid/DocDir/ --pdfdir=/usr/local/zabbix/bulid/DocDir/

9、然后根据目录来创建一下文件夹,如下图所示:


10、复制到终端,然后进行编译,如下图所示:


11、在最后提示一个错误,说是没有MySql库,如下图所示:


12、然后使用yum install mysql-devel来安装mysql库,如下图所示:


13、然后出现如下截图时,输入y回车即可,如下图所示:



14、然后重新configur,会提示缺少LIBXML2库,如下图所示:


15、使用yum install libxml2-devel命令进行安装,如下图所示:



16、然后重新configur,会提示缺少Net-SNMP目录,如下图所示:


17、然后使用yum install net-snmp-devel命令来安装,如下图所示:



18、然后重新configur,会提示缺少OPENIPMI库,如下图所示:


19、首先使用yum install OpenIPMI命令安装,如下图所示:


20、然后从https://pkgs.org/centos-6/centos-x86_64/OpenIPMI-2.0.16-14.el6.x86_64.rpm.html地址下载OpenIPMI-devel-2.0.16-14.el6.x86_64.rpm文件,如下图所示:


21、使用rpm -ivh OpenIPMI-devel-2.0.16-14.el6.x86_64.rpm 命令进行安装,如下图所示:


22、安装时会提示一下错误,如下图所示:


23、然后使用yun install ncurses-devel 命令进行安装,如下图所示:



24、然后在使用rpm -ivh OpenIPMI-devel-2.0.16-14.el6.x86_64.rpm 命令进行安装,如下图所示:


25、然后重新configur,会提示缺少javac库,这是由于没有配置java环境,配置java环境的方法请到http://blog.csdn.net/sunxiaoju/article/details/51994559查看,如下图所示:


26、然后重新configur,会提示缺少Curl库,如下图所示:


27、使用yum install curl-devel 命令进行安装,如下图所示:


28、如果没有错误会出现一下界面,如下图所示:


29、然后执行make install 命令,如下图所示:


30、执行完之后会出现一下信息,如下图所示:


32、最后会生成一些文件,在bin文件夹下有zabbix_get,zabbix_sender如下图所示:


33、在sbin下有zabbix_agentd、zabbix_proxy、zabbix_server等文件,如下图所示:


34、在etc文件夹下有zabbix_agentd.conf、zabbix_proxy.conf、zabbix_server.conf等配置文件,如下图所示:















































  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值