使用Ubuntu系统编译安装Zabbix企业级监控系统  

                          作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

  Ubuntu系统部署笔记:https://www.cnblogs.com/yinzhengjie/p/12180899.html.

一.从zabbix官网下载相应版本软件包步骤详解

1>.如下图所示,点击"产品手册"(官网地址:https://www.zabbix.com/cn/manuals)

2>.如下图所示,点击"阅读中文版"

3>.查看官方中文手册,如下图所示,点击"从源代码安装"

4>.打开zabbix的软件包下载页面(https://www.zabbix.com/cn/download_sources)

5>.下载zabbix软件包,如下图所示,选择zabbix版本后,点击"下载"

6>.如上图所示,点击"下载"后会跳转到一个广告页面,下载速度非常快,基本上10秒左右就能搞定

二.编译安装zabbix

1>.将默认软件源仓库更换为阿里云的(目的是为例提速,因为官网默认配置的服务器在国外,当安装一些常用软件时速度会很慢)

  1. [root@zabbix203.yinzhengjie.org.cn ~]# cp /etc/apt/sources.list /etc/apt/sources.list-`date +%F`          #修改文件前需要做备份
  1. [root@zabbix203.yinzhengjie.org.cn ~]# vim /etc/apt/sources.list
  2. [root@zabbix203.yinzhengjie.org.cn ~]#
  3. [root@zabbix203.yinzhengjie.org.cn ~]# cat /etc/apt/sources.list
  4. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  5. deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  6.  
  7. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  9.  
  10. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  11. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  12.  
  13. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  14. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  15.  
  16. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  17. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  18. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# vim /etc/apt/sources.list                             #修改默认的软件源为阿里的仓库

  1. [root@zabbix203.yinzhengjie.org.cn ~]# apt update
  2. Get: http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]
  3. Get: http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]
  4. Get: http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]
  5. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]
  6. Get: http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [74.6 kB]
  7. Get: http://mirrors.aliyun.com/ubuntu bionic/restricted Sources [5,324 B]
  8. Get: http://mirrors.aliyun.com/ubuntu bionic/universe Sources [9,051 kB]
  9. Get: http://mirrors.aliyun.com/ubuntu bionic/multiverse Sources [181 kB]
  10. Get: http://mirrors.aliyun.com/ubuntu bionic/main Sources [829 kB]
  11. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 Packages [1,019 kB]
  12. Get: http://mirrors.aliyun.com/ubuntu bionic/main Translation-en [516 kB]
  13. Get: http://mirrors.aliyun.com/ubuntu bionic/restricted amd64 Packages [9,184 B]
  14. Get: http://mirrors.aliyun.com/ubuntu bionic/restricted Translation-en [3,584 B]
  15. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
  16. Get: http://mirrors.aliyun.com/ubuntu bionic/universe Translation-en [4,941 kB]
  17. Get: http://mirrors.aliyun.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
  18. Get: http://mirrors.aliyun.com/ubuntu bionic/multiverse Translation-en [108 kB]
  19. Get: http://mirrors.aliyun.com/ubuntu bionic-security/restricted Sources [4,548 B]
  20. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe Sources [166 kB]
  21. Get: http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Sources [3,180 B]
  22. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main Sources [142 kB]
  23. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 Packages [636 kB]
  24. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main Translation-en [208 kB]
  25. Get: http://mirrors.aliyun.com/ubuntu bionic-security/restricted amd64 Packages [21.2 kB]
  26. Get: http://mirrors.aliyun.com/ubuntu bionic-security/restricted Translation-en [5,984 B]
  27. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 Packages [644 kB]
  28. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe Translation-en [217 kB]
  29. Get: http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 Packages [6,340 B]
  30. Get: http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Translation-en [2,640 B]
  31. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Sources [6,540 B]
  32. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/universe Sources [277 kB]
  33. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Sources [5,840 B]
  34. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main Sources [307 kB]
  35. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [853 kB]
  36. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main Translation-en [298 kB]
  37. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/restricted amd64 Packages [30.2 kB]
  38. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Translation-en [7,928 B]
  39. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 Packages [1,048 kB]
  40. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/universe Translation-en [324 kB]
  41. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 Packages [9,700 B]
  42. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Translation-en [4,576 B]
  43. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main Sources [71.2 kB]
  44. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Sources [1,796 B]
  45. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Sources [5,564 B]
  46. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Sources [20.8 kB]
  47. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 Packages [124 kB]
  48. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main Translation-en [43.9 kB]
  49. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted amd64 Packages [16.8 kB]
  50. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Translation-en [5,716 B]
  51. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/universe amd64 Packages [145 kB]
  52. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Translation-en [32.2 kB]
  53. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse amd64 Packages [7,372 B]
  54. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Translation-en [2,796 B]
  55. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/universe Sources [2,496 B]
  56. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/main Sources [2,532 B]
  57. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/main amd64 Packages [2,512 B]
  58. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/main Translation-en [1,644 B]
  59. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 Packages [4,028 B]
  60. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/universe Translation-en [1,900 B]
  61. Fetched 31.8 MB in 5s (, kB/s)
  62. Reading package lists... Done
  63. Building dependency tree
  64. Reading state information... Done
  65. packages can be upgraded. Run 'apt list --upgradable' to see them.
  66. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# apt update

2>.在ubuntu系统环境安装zabbix编译时依赖的库

  1. [root@zabbix203.yinzhengjie.org.cn ~]# apt-get -y install libmysqlclient-dev libxml2-dev libxml2 libsnmp-dev libevent-dev libcurl4-openssl-dev openjdk--jdk
  2.  
  3. 温馨提示:
  4.   如果缺少任意一个库均可以能会编译报错,参考笔记:https://www.cnblogs.com/yinzhengjie2020/p/12306882.html

3>.将下载的zabbix软件包上传到服务器

  1. [root@zabbix203.yinzhengjie.org.cn ~]# apt-get -y install lrzsz
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. Suggested packages:
  6. minicom
  7. The following NEW packages will be installed:
  8. lrzsz
  9. 0 upgraded, 1 newly installed, 0 to remove and 136 not upgraded.
  10. Need to get 74.8 kB of archives.
  11. After this operation, 531 kB of additional disk space will be used.
  12. Get:1 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 lrzsz amd64 0.12.21-10~build0.18.04.1 [74.8 kB]
  13. Fetched 74.8 kB in 0s (330 kB/s)
  14. Selecting previously unselected package lrzsz.
  15. (Reading database ... 67267 files and directories currently installed.)
  16. Preparing to unpack .../lrzsz_0.12.21-10~build0.18.04.1_amd64.deb ...
  17. Unpacking lrzsz (0.12.21-10~build0.18.04.1) ...
  18. Setting up lrzsz (0.12.21-10~build0.18.04.1) ...
  19. Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
  20. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# apt-get -y install lrzsz              #小于4G的文件都可以使用该命令行工具进行上传哟~

3>.解压zabbix的软件包

  1. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]# ll
  2. total
  3. drwxr-xr-x root root Feb : ./
  4. drwxr-xr-x root root Aug ../
  5. -rw-r--r-- root root Feb : zabbix-4.0..tar.gz
  6. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]#
  7. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]#
  8. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]# tar -zxf zabbix-4.0..tar.gz
  9. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]#
  10. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]# ll
  11. total
  12. drwxr-xr-x root root Feb : ./
  13. drwxr-xr-x root root Aug ../
  14. drwxr-xr-x Jan : zabbix-4.0./
  15. -rw-r--r-- root root Feb : zabbix-4.0..tar.gz
  16. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]#
  17. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]# ll zabbix-4.0.
  18. total
  19. drwxr-xr-x Jan : ./
  20. drwxr-xr-x root root Feb : ../
  21. -rw-r--r-- Jan : aclocal.m4
  22. -rw-r--r-- Jan : AUTHORS
  23. drwxr-xr-x Jan : bin/
  24. drwxr-xr-x Jan : build/
  25. -rw-r--r-- Jan : ChangeLog
  26. -rwxr-xr-x Jan compile*
  27. drwxr-xr-x Jan : conf/
  28. -rwxr-xr-x Nov config.guess*
  29. -rwxr-xr-x Nov config.sub*
  30. -rwxr-xr-x Jan : configure*
  31. -rw-r--r-- Jan : configure.ac
  32. -rw-r--r-- Jan : COPYING
  33. drwxr-xr-x Jan : database/
  34. -rwxr-xr-x Jan depcomp*
  35. drwxr-xr-x Jan : frontends/
  36. drwxr-xr-x Jan : include/
  37. -rw-r--r-- Jan : INSTALL
  38. -rwxr-xr-x Jan install-sh*
  39. drwxr-xr-x Jan : m4/
  40. -rw-r--r-- Jan : Makefile.am
  41. -rw-r--r-- Jan : Makefile.in
  42. drwxr-xr-x Jan : man/
  43. drwxr-xr-x Jan : misc/
  44. -rwxr-xr-x Jan missing*
  45. -rw-r--r-- Jan : NEWS
  46. -rw-r--r-- Jan : README
  47. drwxr-xr-x Jan : sass/
  48. drwxr-xr-x Jan : src/
  49. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]#
  50. [root@zabbix203.yinzhengjie.org.cn /usr/local/src]#

[root@zabbix203.yinzhengjie.org.cn /usr/local/src]# tar -zxf zabbix-4.0.17.tar.gz

4>.配置zabbix需要安装的软件包

  1. [root@zabbix203.yinzhengjie.org.cn /usr/local/src/zabbix-4.0.]# ./configure --help
  2. `configure' configures Zabbix 4.0.17 to adapt to many kinds of systems.
  3.  
  4. Usage: ./configure [OPTION]... [VAR=VALUE]...
  5.  
  6. To assign environment variables (e.g., CC, CFLAGS...), specify them as
  7. VAR=VALUE. See below for descriptions of some of the useful variables.
  8.  
  9. Defaults for the options are specified in brackets.
  10.  
  11. Configuration:
  12. -h, --help display this help and exit
  13. --help=short display options specific to this package
  14. --help=recursive display the short help of all the included packages
  15. -V, --version display version information and exit
  16. -q, --quiet, --silent do not print `checking ...' messages
  17. --cache-file=FILE cache test results in FILE [disabled]
  18. -C, --config-cache alias for `--cache-file=config.cache'
  19. -n, --no-create do not create output files
  20. --srcdir=DIR find the sources in DIR [configure dir or `..']
  21.  
  22. Installation directories:
  23. --prefix=PREFIX install architecture-independent files in PREFIX
  24. [/usr/local]
  25. --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
  26. [PREFIX]
  27.  
  28. By default, `make install' will install all the files in
  29. `/usr/local/bin', `/usr/local/lib' etc. You can specify
  30. an installation prefix other than `/usr/local' using `--prefix',
  31. for instance `--prefix=$HOME'.
  32.  
  33. For better control, use the options below.
  34.  
  35. Fine tuning of the installation directories:
  36. --bindir=DIR user executables [EPREFIX/bin]
  37. --sbindir=DIR system admin executables [EPREFIX/sbin]
  38. --libexecdir=DIR program executables [EPREFIX/libexec]
  39. --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
  40. --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
  41. --localstatedir=DIR modifiable single-machine data [PREFIX/var]
  42. --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
  43. --libdir=DIR object code libraries [EPREFIX/lib]
  44. --includedir=DIR C header files [PREFIX/include]
  45. --oldincludedir=DIR C header files for non-gcc [/usr/include]
  46. --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
  47. --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
  48. --infodir=DIR info documentation [DATAROOTDIR/info]
  49. --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
  50. --mandir=DIR man documentation [DATAROOTDIR/man]
  51. --docdir=DIR documentation root [DATAROOTDIR/doc/zabbix]
  52. --htmldir=DIR html documentation [DOCDIR]
  53. --dvidir=DIR dvi documentation [DOCDIR]
  54. --pdfdir=DIR pdf documentation [DOCDIR]
  55. --psdir=DIR ps documentation [DOCDIR]
  56.  
  57. Program names:
  58. --program-prefix=PREFIX prepend PREFIX to installed program names
  59. --program-suffix=SUFFIX append SUFFIX to installed program names
  60. --program-transform-name=PROGRAM run sed PROGRAM on installed program names
  61.  
  62. System types:
  63. --build=BUILD configure for building on BUILD [guessed]
  64. --host=HOST cross-compile to build programs to run on HOST [BUILD]
  65.  
  66. Optional Features:
  67. --disable-option-checking ignore unrecognized --enable/--with options
  68. --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
  69. --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
  70. --enable-silent-rules less verbose build output (undo: "make V=1")
  71. --disable-silent-rules verbose build output (undo: "make V=0")
  72. --enable-dependency-tracking
  73. do not reject slow dependency extractors
  74. --disable-dependency-tracking
  75. speeds up one-time build
  76. --disable-largefile omit support for large files
  77. --enable-static Build statically linked binaries
  78. --enable-server Turn on build of Zabbix server
  79. --enable-proxy Turn on build of Zabbix proxy
  80. --enable-agent Turn on build of Zabbix agent and client utilities
  81. --enable-java Turn on build of Zabbix Java gateway
  82. --enable-ipv6 Turn on support of IPv6
  83.  
  84. Optional Packages:
  85. --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
  86. --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
  87. --with-ibm-db2[=ARG] use IBM DB2 CLI from given sqllib directory
  88. (ARG=path); use /home/db2inst1/sqllib (ARG=yes);
  89. disable IBM DB2 support (ARG=no)
  90. --with-ibm-db2-include[=DIR]
  91. use IBM DB2 CLI headers from given path
  92. --with-ibm-db2-lib[=DIR]
  93. use IBM DB2 CLI libraries from given path
  94. --with-mysql[=ARG] use MySQL client library [default=no], optionally
  95. specify path to mysql_config
  96. --with-oracle[=ARG] use Oracle OCI API from given Oracle home
  97. (ARG=path); use existing ORACLE_HOME (ARG=yes);
  98. disable Oracle OCI support (ARG=no)
  99. --with-oracle-include[=DIR]
  100. use Oracle OCI API headers from given path
  101. --with-oracle-lib[=DIR] use Oracle OCI API libraries from given path
  102. --with-postgresql[=ARG] use PostgreSQL library [default=no], optionally
  103. specify path to pg_config
  104. --with-sqlite3[=ARG] use SQLite library [default=no], optionally
  105. specify the prefix for sqlite3 library
  106.  
  107. If you want to use Jabber protocol for messaging:
  108. --with-jabber[=DIR] Include Jabber support [default=no]. DIR is the
  109. iksemel library install directory.
  110.  
  111. If you want to use XML library:
  112. --with-libxml2[=ARG] use libxml2 client library [default=no], optionally
  113. specify path to xml2-config
  114.  
  115. If you want to use unixODBC library:
  116. --with-unixodbc[=ARG] use ODBC driver against unixODBC package
  117. [default=no], optionally specify full path to
  118. odbc_config binary.
  119.  
  120. If you want to use Net-SNMP library:
  121. --with-net-snmp[=ARG] use Net-SNMP package [default=no], optionally
  122. specify path to net-snmp-config
  123.  
  124. If you want to use SSH2 based checks:
  125. --with-ssh2[=DIR] use SSH2 package [default=no], DIR is the SSH2
  126. library install directory.
  127.  
  128. If you want to check IPMI devices:
  129. --with-openipmi[=DIR] Include OPENIPMI support [default=no]. DIR is the
  130. OPENIPMI base install directory, default is to
  131. search through a number of common places for the
  132. OPENIPMI files.
  133.  
  134. If you want to specify zlib installation directories:
  135. --with-zlib=DIR use zlib from given base install directory (DIR),
  136. default is to search through a number of common
  137. places for the zlib files.
  138. --with-zlib-include=DIR use zlib include headers from given path.
  139. --with-zlib-lib=DIR use zlib libraries from given path.
  140.  
  141. If you want to specify pthread installation directories:
  142. --with-libpthread[=DIR] use libpthread from given base install directory
  143. (DIR), default is to search through a number of
  144. common places for the libpthread files.
  145. --with-libpthread-include[=DIR]
  146. use libpthread include headers from given path.
  147. --with-libpthread-lib[=DIR]
  148. use libpthread libraries from given path.
  149.  
  150. If you want to specify libevent installation directories:
  151. --with-libevent[=DIR] use libevent from given base install directory
  152. (DIR), default is to search through a number of
  153. common places for the libevent files.
  154. --with-libevent-include[=DIR]
  155. use libevent include headers from given path.
  156. --with-libevent-lib[=DIR]
  157. use libevent libraries from given path.
  158.  
  159. If you want to use encryption provided by mbed TLS (PolarSSL) library:
  160. --with-mbedtls[=DIR] use mbed TLS (PolarSSL) package [default=no], DIR is
  161. the libpolarssl install directory.
  162.  
  163. If you want to use encryption provided by GnuTLS library:
  164. --with-gnutls[=DIR] use GnuTLS package [default=no], DIR is the
  165. libgnutls install directory.
  166.  
  167. If you want to use encryption provided by OpenSSL library:
  168. --with-openssl[=DIR] use OpenSSL package [default=no], DIR is the libssl
  169. and libcrypto install directory.
  170.  
  171. If you want to check LDAP servers:
  172. --with-ldap[=DIR] Include LDAP support [default=no]. DIR is the LDAP
  173. base install directory, default is to search through
  174. a number of common places for the LDAP files.
  175.  
  176. If you want to use cURL library:
  177. --with-libcurl[=DIR] use cURL package [default=no], optionally specify
  178. path to curl-config
  179.  
  180. If you want to specify libpcre installation directories:
  181. --with-libpcre[=DIR] use libpcre from given base install directory (DIR),
  182. default is to search through a number of common
  183. places for the libpcre files.
  184. --with-libpcre-include[=DIR]
  185. use libpcre include headers from given path.
  186. --with-libpcre-lib[=DIR]
  187. use libpcre libraries from given path.
  188.  
  189. If you want to specify iconv installation directories:
  190. --with-iconv[=DIR] use iconv from given base install directory (DIR),
  191. default is to search through a number of common
  192. places for the iconv files.
  193. --with-iconv-include[=DIR]
  194. use iconv include headers from given path.
  195. --with-iconv-lib[=DIR] use iconv libraries from given path.
  196.  
  197. Some influential environment variables:
  198. CC C compiler command
  199. CFLAGS C compiler flags
  200. LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
  201. nonstandard directory <lib dir>
  202. LIBS libraries to pass to the linker, e.g. -l<library>
  203. CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
  204. you have headers in a nonstandard directory <include dir>
  205. CPP C preprocessor
  206. PKG_CONFIG path to pkg-config utility
  207. PKG_CONFIG_PATH
  208. directories to add to pkg-config's search path
  209. PKG_CONFIG_LIBDIR
  210. path overriding pkg-config's built-in search path
  211. IKSEMEL_CFLAGS
  212. C compiler flags for IKSEMEL, overriding pkg-config
  213. IKSEMEL_LIBS
  214. linker flags for IKSEMEL, overriding pkg-config
  215.  
  216. Use these variables to override the choices made by `configure' or to help
  217. it to find libraries and programs with nonstandard names/locations.
  218.  
  219. Report bugs to the package provider.
  220. [root@zabbix203.yinzhengjie.org.cn /usr/local/src/zabbix-4.0.]#
  221. [root@zabbix203.yinzhengjie.org.cn /usr/local/src/zabbix-4.0.]#

[root@zabbix203.yinzhengjie.org.cn /usr/local/src/zabbix-4.0.17]# ./configure --help

  1. [root@zabbix203.yinzhengjie.org.cn /usr/local/src/zabbix-4.0.]# ./configure --prefix=/yinzhengjie/softwares/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-net-snmp --with-libcurl --with-libxml2
  2.  
  3. 温馨提示:    
  4.     --prefix=/yinzhengjie/softwares/zabbix:
  5.       指定安装的路径
  6.  
  7.     --enable-server:
  8.       表示编译zabbix server服务。
  9.     
  10.     --enable-agent:
  11.       表示编译zabbix agent客户端应用程序。
  12.  
  13.     --enable-java:
  14.       表示编译Zabbix Java gateway,该组件用于监控Java程序。
  15.  
  16.     --with-mysql:
  17.       使用MySQL客户端库[default=no],可以选择指定MySQL配置的路径。
  18.     
  19.     --with-net-snmp:
  20.       使用Net SNMP包[default=no],可以选择指定netsnmp配置的路径。
  21.  
  22.     --with-libcurl:
  23.       使用cURL包[default=no],可以选择指定cURL配置的路径。
  24.  
  25.     --with-libxml2:
  26.       使用libxml2客户端库[default=no],可以选择指定xml2配置的路径。

5>.编译并安装zabbix软件

  1. [root@zabbix203.yinzhengjie.org.cn ~]# lscpu
  2. Architecture: x86_64
  3. CPU op-mode(s): -bit, -bit
  4. Byte Order: Little Endian
  5. CPU(s):
  6. On-line CPU(s) list: ,
  7. Thread(s) per core:
  8. Core(s) per socket:
  9. Socket(s):
  10. NUMA node(s):
  11. Vendor ID: GenuineIntel
  12. CPU family:
  13. Model:
  14. Model name: Intel(R) Core(TM) i7-8750H CPU @ .20GHz
  15. Stepping:
  16. CPU MHz: 2207.998
  17. BogoMIPS: 4415.99
  18. Hypervisor vendor: VMware
  19. Virtualization type: full
  20. L1d cache: 32K
  21. L1i cache: 32K
  22. L2 cache: 256K
  23. L3 cache: 9216K
  24. NUMA node0 CPU(s): ,
  25. Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht sysca
  26. ll nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xsaves arat md_clear flush_l1d arch_capabilities[root@zabbix203.yinzhengjie.org.cn ~]#
  27. [root@zabbix203.yinzhengjie.org.cn ~]#
  28. [root@zabbix203.yinzhengjie.org.cn ~]# lscpu | grep "^CPU(s)"
  29. CPU(s):
  30. [root@zabbix203.yinzhengjie.org.cn ~]#
  31. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# lscpu | grep "^CPU(s)"

  1. [root@zabbix203.yinzhengjie.org.cn /usr/local/src/zabbix-4.0.]# make -j && make install

6>.zabbix编译安装成功会生成相应的目录

  1. [root@zabbix203.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares
  2. total
  3. drwxr-xr-x root root Feb : ./
  4. drwxr-xr-x root root Feb : ../
  5. drwxr-xr-x root root Feb : zabbix/
  6. [root@zabbix203.yinzhengjie.org.cn ~]#
  7. [root@zabbix203.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/zabbix/
  8. total
  9. drwxr-xr-x root root Feb : ./
  10. drwxr-xr-x root root Feb : ../
  11. drwxr-xr-x root root Feb : bin/
  12. drwxr-xr-x root root Feb : etc/
  13. drwxr-xr-x root root Feb : lib/
  14. drwxr-xr-x root root Feb : sbin/
  15. drwxr-xr-x root root Feb : share/
  16. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/zabbix/

 

三.安装数据库并授权

1>.将默认软件源仓库更换为阿里云的(目的是为例提速,因为官网默认配置的服务器在国外,当安装一些常用软件时速度会很慢)

  1. [root@yinzhengjie.org.cn ~]# cp /etc/apt/sources.list /etc/apt/sources.list-`date +%F`          #修改文件前一定要先做好备份。
  1. [root@yinzhengjie.org.cn ~]# vim /etc/apt/sources.list
  2. [root@yinzhengjie.org.cn ~]#
  3. [root@yinzhengjie.org.cn ~]# cat /etc/apt/sources.list
  4. deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  5. deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
  6.  
  7. deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  8. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
  9.  
  10. deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  11. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
  12.  
  13. deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  14. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
  15.  
  16. deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  17. deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
  18. [root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# vim /etc/apt/sources.list

  1. [root@yinzhengjie.org.cn ~]# apt update
  2. Get: http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]
  3. Get: http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]
  4. Get: http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]
  5. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]
  6. Get: http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [74.6 kB]
  7. Get: http://mirrors.aliyun.com/ubuntu bionic/main Sources [829 kB]
  8. Get: http://mirrors.aliyun.com/ubuntu bionic/universe Sources [9,051 kB]
  9. Get: http://mirrors.aliyun.com/ubuntu bionic/multiverse Sources [181 kB]
  10. Get: http://mirrors.aliyun.com/ubuntu bionic/restricted Sources [5,324 B]
  11. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 Packages [1,019 kB]
  12. Get: http://mirrors.aliyun.com/ubuntu bionic/main Translation-en [516 kB]
  13. Get: http://mirrors.aliyun.com/ubuntu bionic/restricted amd64 Packages [9,184 B]
  14. Get: http://mirrors.aliyun.com/ubuntu bionic/restricted Translation-en [3,584 B]
  15. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 Packages [8,570 kB]
  16. Get: http://mirrors.aliyun.com/ubuntu bionic/universe Translation-en [4,941 kB]
  17. Get: http://mirrors.aliyun.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
  18. Get: http://mirrors.aliyun.com/ubuntu bionic/multiverse Translation-en [108 kB]
  19. Get: http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Sources [3,180 B]
  20. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe Sources [166 kB]
  21. Get: http://mirrors.aliyun.com/ubuntu bionic-security/restricted Sources [4,548 B]
  22. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main Sources [142 kB]
  23. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 Packages [636 kB]
  24. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main Translation-en [208 kB]
  25. Get: http://mirrors.aliyun.com/ubuntu bionic-security/restricted amd64 Packages [21.2 kB]
  26. Get: http://mirrors.aliyun.com/ubuntu bionic-security/restricted Translation-en [5,984 B]
  27. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 Packages [644 kB]
  28. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe Translation-en [217 kB]
  29. Get: http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 Packages [6,340 B]
  30. Get: http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Translation-en [2,640 B]
  31. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main Sources [307 kB]
  32. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/universe Sources [277 kB]
  33. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Sources [6,540 B]
  34. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Sources [5,840 B]
  35. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [853 kB]
  36. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main Translation-en [298 kB]
  37. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/restricted amd64 Packages [30.2 kB]
  38. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Translation-en [7,928 B]
  39. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 Packages [1,048 kB]
  40. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/universe Translation-en [324 kB]
  41. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 Packages [9,700 B]
  42. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Translation-en [4,576 B]
  43. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Sources [20.8 kB]
  44. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main Sources [71.2 kB]
  45. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Sources [5,564 B]
  46. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Sources [1,796 B]
  47. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 Packages [124 kB]
  48. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/main Translation-en [43.9 kB]
  49. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted amd64 Packages [16.8 kB]
  50. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Translation-en [5,716 B]
  51. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/universe amd64 Packages [145 kB]
  52. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Translation-en [32.2 kB]
  53. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse amd64 Packages [7,372 B]
  54. Get: http://mirrors.aliyun.com/ubuntu bionic-proposed/multiverse Translation-en [2,796 B]
  55. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/main Sources [2,532 B]
  56. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/universe Sources [2,496 B]
  57. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/main amd64 Packages [2,512 B]
  58. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/main Translation-en [1,644 B]
  59. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 Packages [4,028 B]
  60. Get: http://mirrors.aliyun.com/ubuntu bionic-backports/universe Translation-en [1,900 B]
  61. Fetched 31.8 MB in 6s (, kB/s)
  62. Reading package lists... Done
  63. Building dependency tree
  64. Reading state information... Done
  65. packages can be upgraded. Run 'apt list --upgradable' to see them.
  66. [root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# apt update

2>.安装MariaDB数据库并修改数据库的默认监听地址

  1. [root@yinzhengjie.org.cn ~]# apt-get -y install mariadb-server
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. The following additional packages will be installed:
  6. galera- libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  7. libjemalloc1 liblwp-mediatypes-perl libmysqlclient20 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server-10.1 mariadb-server-core-10.1 mysql-common socat
  8. Suggested packages:
  9. libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test tinyca
  10. The following NEW packages will be installed:
  11. galera- libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl
  12. libjemalloc1 liblwp-mediatypes-perl libmysqlclient20 libterm-readkey-perl libtimedate-perl liburi-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mariadb-server mariadb-server-10.1 mariadb-server-core-10.1 mysql-common socat
  13. upgraded, newly installed, to remove and not upgraded.
  14. Need to get 24.1 MB of archives.
  15. After this operation, MB of additional disk space will be used.
  16. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 mysql-common all 5.8+1.0.4 [7,308 B]
  17. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-common all 1:10.1.44-0ubuntu0.18.04.1 [16.1 kB]
  18. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 galera-3 amd64 25.3.20-1 [947 kB]
  19. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libdbi-perl amd64 1.640-1 [724 kB]
  20. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libconfig-inifiles-perl all 2.94-1 [40.4 kB]
  21. Get: http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6,476 B]
  22. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-client-core-10.1 amd64 1:10.1.44-0ubuntu0.18.04.1 [4,772 kB]
  23. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libjemalloc1 amd64 3.6.0-11 [82.4 kB]
  24. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-client-10.1 amd64 1:10.1.44-0ubuntu0.18.04.1 [5,641 kB]
  25. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-server-core-10.1 amd64 1:10.1.44-0ubuntu0.18.04.1 [4,952 kB]
  26. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 socat amd64 1.7.3.2-2ubuntu2 [342 kB]
  27. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-server-10.1 amd64 1:10.1.44-0ubuntu0.18.04.1 [5,099 kB]
  28. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhtml-tagset-perl all 3.20-3 [12.1 kB]
  29. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 liburi-perl all 1.73-1 [77.2 kB]
  30. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhtml-parser-perl amd64 3.72-3build1 [85.9 kB]
  31. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libcgi-pm-perl all 4.38-1 [185 kB]
  32. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libfcgi-perl amd64 0.78-2build1 [32.8 kB]
  33. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libcgi-fast-perl all 1:2.13-1 [9,940 B]
  34. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 libmysqlclient20 amd64 5.7.29-0ubuntu0.18.04.1 [690 kB]
  35. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libdbd-mysql-perl amd64 4.046-1 [82.0 kB]
  36. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libencode-locale-perl all 1.05-1 [12.3 kB]
  37. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhtml-template-perl all 2.97-1 [59.0 kB]
  38. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]
  39. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhttp-date-perl all 6.02-1 [10.4 kB]
  40. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libio-html-perl all 1.001-1 [14.9 kB]
  41. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 liblwp-mediatypes-perl all 6.02-1 [21.7 kB]
  42. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 libhttp-message-perl all 6.14-1 [72.1 kB]
  43. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libterm-readkey-perl amd64 2.37-1build1 [24.4 kB]
  44. Get: http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-server all 1:10.1.44-0ubuntu0.18.04.1 [12.9 kB]
  45. Fetched 24.1 MB in 4s (, kB/s)
  46. Preconfiguring packages ...
  47. Selecting previously unselected package mysql-common.
  48. (Reading database ... files and directories currently installed.)
  49. Preparing to unpack .../-mysql-common_5.+1.0.4_all.deb ...
  50. Unpacking mysql-common (5.8+1.0.) ...
  51. Selecting previously unselected package mariadb-common.
  52. Preparing to unpack .../-mariadb-common_1%3a10.1.44-0ubuntu0.18.04.1_all.deb ...
  53. Unpacking mariadb-common (:10.1.-0ubuntu0.18.04.) ...
  54. Selecting previously unselected package galera-.
  55. Preparing to unpack .../-galera-3_25.3.20-1_amd64.deb ...
  56. Unpacking galera- (25.3.-) ...
  57. Selecting previously unselected package libdbi-perl.
  58. Preparing to unpack .../-libdbi-perl_1.-1_amd64.deb ...
  59. Unpacking libdbi-perl (1.640-) ...
  60. Selecting previously unselected package libconfig-inifiles-perl.
  61. Preparing to unpack .../-libconfig-inifiles-perl_2.-1_all.deb ...
  62. Unpacking libconfig-inifiles-perl (2.94-) ...
  63. Selecting previously unselected package libaio1:amd64.
  64. Preparing to unpack .../-libaio1_0.3.110-5ubuntu0.1_amd64.deb ...
  65. Unpacking libaio1:amd64 (0.3.-5ubuntu0.) ...
  66. Selecting previously unselected package mariadb-client-core-10.1.
  67. Preparing to unpack .../-mariadb-client-core-.1_1%3a10.1.44-0ubuntu0.18.04.1_amd64.deb ...
  68. Unpacking mariadb-client-core-10.1 (:10.1.-0ubuntu0.18.04.) ...
  69. Selecting previously unselected package libjemalloc1.
  70. Preparing to unpack .../-libjemalloc1_3.6.0-11_amd64.deb ...
  71. Unpacking libjemalloc1 (3.6.-) ...
  72. Selecting previously unselected package mariadb-client-10.1.
  73. Preparing to unpack .../-mariadb-client-.1_1%3a10.1.44-0ubuntu0.18.04.1_amd64.deb ...
  74. Unpacking mariadb-client-10.1 (:10.1.-0ubuntu0.18.04.) ...
  75. Selecting previously unselected package mariadb-server-core-10.1.
  76. Preparing to unpack .../-mariadb-server-core-.1_1%3a10.1.44-0ubuntu0.18.04.1_amd64.deb ...
  77. Unpacking mariadb-server-core-10.1 (:10.1.-0ubuntu0.18.04.) ...
  78. Selecting previously unselected package socat.
  79. Preparing to unpack .../-socat_1.7.3.-2ubuntu2_amd64.deb ...
  80. Unpacking socat (1.7.3.2-2ubuntu2) ...
  81. Setting up mysql-common (5.8+1.0.) ...
  82. update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
  83. Setting up mariadb-common (:10.1.-0ubuntu0.18.04.) ...
  84. update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
  85. Selecting previously unselected package mariadb-server-10.1.
  86. (Reading database ... files and directories currently installed.)
  87. Preparing to unpack .../-mariadb-server-.1_1%3a10.1.44-0ubuntu0.18.04.1_amd64.deb ...
  88. Unpacking mariadb-server-10.1 (:10.1.-0ubuntu0.18.04.) ...
  89. Selecting previously unselected package libhtml-tagset-perl.
  90. Preparing to unpack .../-libhtml-tagset-perl_3.-3_all.deb ...
  91. Unpacking libhtml-tagset-perl (3.20-) ...
  92. Selecting previously unselected package liburi-perl.
  93. Preparing to unpack .../-liburi-perl_1.-1_all.deb ...
  94. Unpacking liburi-perl (1.73-) ...
  95. Selecting previously unselected package libhtml-parser-perl.
  96. Preparing to unpack .../-libhtml-parser-perl_3.-3build1_amd64.deb ...
  97. Unpacking libhtml-parser-perl (3.72-3build1) ...
  98. Selecting previously unselected package libcgi-pm-perl.
  99. Preparing to unpack .../-libcgi-pm-perl_4.-1_all.deb ...
  100. Unpacking libcgi-pm-perl (4.38-) ...
  101. Selecting previously unselected package libfcgi-perl.
  102. Preparing to unpack .../-libfcgi-perl_0.-2build1_amd64.deb ...
  103. Unpacking libfcgi-perl (0.78-2build1) ...
  104. Selecting previously unselected package libcgi-fast-perl.
  105. Preparing to unpack .../-libcgi-fast-perl_1%3a2.-1_all.deb ...
  106. Unpacking libcgi-fast-perl (:2.13-) ...
  107. Selecting previously unselected package libmysqlclient20:amd64.
  108. Preparing to unpack .../-libmysqlclient20_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
  109. Unpacking libmysqlclient20:amd64 (5.7.-0ubuntu0.18.04.) ...
  110. Selecting previously unselected package libdbd-mysql-perl.
  111. Preparing to unpack .../-libdbd-mysql-perl_4.-1_amd64.deb ...
  112. Unpacking libdbd-mysql-perl (4.046-) ...
  113. Selecting previously unselected package libencode-locale-perl.
  114. Preparing to unpack .../-libencode-locale-perl_1.-1_all.deb ...
  115. Unpacking libencode-locale-perl (1.05-) ...
  116. Selecting previously unselected package libhtml-template-perl.
  117. Preparing to unpack .../-libhtml-template-perl_2.-1_all.deb ...
  118. Unpacking libhtml-template-perl (2.97-) ...
  119. Selecting previously unselected package libtimedate-perl.
  120. Preparing to unpack .../-libtimedate-perl_2.-2_all.deb ...
  121. Unpacking libtimedate-perl (2.3000-) ...
  122. Selecting previously unselected package libhttp-date-perl.
  123. Preparing to unpack .../-libhttp-date-perl_6.-1_all.deb ...
  124. Unpacking libhttp-date-perl (6.02-) ...
  125. Selecting previously unselected package libio-html-perl.
  126. Preparing to unpack .../-libio-html-perl_1.-1_all.deb ...
  127. Unpacking libio-html-perl (1.001-) ...
  128. Selecting previously unselected package liblwp-mediatypes-perl.
  129. Preparing to unpack .../-liblwp-mediatypes-perl_6.-1_all.deb ...
  130. Unpacking liblwp-mediatypes-perl (6.02-) ...
  131. Selecting previously unselected package libhttp-message-perl.
  132. Preparing to unpack .../-libhttp-message-perl_6.-1_all.deb ...
  133. Unpacking libhttp-message-perl (6.14-) ...
  134. Selecting previously unselected package libterm-readkey-perl.
  135. Preparing to unpack .../-libterm-readkey-perl_2.-1build1_amd64.deb ...
  136. Unpacking libterm-readkey-perl (2.37-1build1) ...
  137. Selecting previously unselected package mariadb-server.
  138. Preparing to unpack .../-mariadb-server_1%3a10.1.44-0ubuntu0.18.04.1_all.deb ...
  139. Unpacking mariadb-server (:10.1.-0ubuntu0.18.04.) ...
  140. Setting up libhtml-tagset-perl (3.20-) ...
  141. Setting up libconfig-inifiles-perl (2.94-) ...
  142. Processing triggers for ureadahead (0.100.-) ...
  143. Setting up libencode-locale-perl (1.05-) ...
  144. Setting up libjemalloc1 (3.6.-) ...
  145. Setting up libtimedate-perl (2.3000-) ...
  146. Setting up socat (1.7.3.2-2ubuntu2) ...
  147. Setting up libio-html-perl (1.001-) ...
  148. Setting up libterm-readkey-perl (2.37-1build1) ...
  149. Setting up liblwp-mediatypes-perl (6.02-) ...
  150. Processing triggers for libc-bin (2.27-3ubuntu1) ...
  151. Setting up libaio1:amd64 (0.3.-5ubuntu0.) ...
  152. Setting up galera- (25.3.-) ...
  153. Setting up liburi-perl (1.73-) ...
  154. Processing triggers for systemd (-3ubuntu10.) ...
  155. Setting up libhtml-parser-perl (3.72-3build1) ...
  156. Setting up libcgi-pm-perl (4.38-) ...
  157. Processing triggers for man-db (2.8.-2ubuntu0.) ...
  158. Setting up libmysqlclient20:amd64 (5.7.-0ubuntu0.18.04.) ...
  159. Setting up libfcgi-perl (0.78-2build1) ...
  160. Setting up libdbi-perl (1.640-) ...
  161. Setting up libhttp-date-perl (6.02-) ...
  162. Setting up mariadb-server-core-10.1 (:10.1.-0ubuntu0.18.04.) ...
  163. Setting up libhtml-template-perl (2.97-) ...
  164. Setting up mariadb-client-core-10.1 (:10.1.-0ubuntu0.18.04.) ...
  165. Setting up libcgi-fast-perl (:2.13-) ...
  166. Setting up libhttp-message-perl (6.14-) ...
  167. Setting up libdbd-mysql-perl (4.046-) ...
  168. Setting up mariadb-client-10.1 (:10.1.-0ubuntu0.18.04.) ...
  169. Setting up mariadb-server-10.1 (:10.1.-0ubuntu0.18.04.) ...
  170. Created symlink /etc/systemd/system/mysql.service /lib/systemd/system/mariadb.service.
  171. Created symlink /etc/systemd/system/mysqld.service /lib/systemd/system/mariadb.service.
  172. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service /lib/systemd/system/mariadb.service.
  173. Setting up mariadb-server (:10.1.-0ubuntu0.18.04.) ...
  174. Processing triggers for libc-bin (2.27-3ubuntu1) ...
  175. Processing triggers for ureadahead (0.100.-) ...
  176. Processing triggers for systemd (-3ubuntu10.) ...
  177. [root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# apt-get -y install mariadb-server

  1. [root@yinzhengjie.org.cn ~]# ss -ntl
  2. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  3. LISTEN 127.0.0.53%lo: 0.0.0.0:*
  4. LISTEN 0.0.0.0: 0.0.0.0:*
  5. LISTEN 127.0.0.1: 0.0.0.0:*
  6. LISTEN [::]: [::]:*
  7. [root@yinzhengjie.org.cn ~]#
  8. [root@yinzhengjie.org.cn ~]# grep bind-address /etc/mysql/ -R
  9. /etc/mysql/mariadb.conf.d/-server.cnf:bind-address = 127.0.0.1
  10. [root@yinzhengjie.org.cn ~]#
  11. [root@yinzhengjie.org.cn ~]# grep 127.0.0.1 /etc/mysql/ -R
  12. /etc/mysql/mariadb.conf.d/-server.cnf:bind-address = 127.0.0.1
  13. [root@yinzhengjie.org.cn ~]#
  14. [root@yinzhengjie.org.cn ~]# ifconfig ens33 | sed -nr '2s/^[^0-9]+([0-9.]+).*/\1/p'
  15. 172.200.5.202
  16. [root@yinzhengjie.org.cn ~]#
  17. [root@yinzhengjie.org.cn ~]# sed -i 's#127.0.0.1#172.200.5.202#' /etc/mysql/mariadb.conf.d/-server.cnf
  18. [root@yinzhengjie.org.cn ~]#
  19. [root@yinzhengjie.org.cn ~]# grep bind-address /etc/mysql/ -R
  20. /etc/mysql/mariadb.conf.d/-server.cnf:bind-address = 172.200.5.202
  21. [root@yinzhengjie.org.cn ~]#
  22. [root@yinzhengjie.org.cn ~]#
  23. [root@yinzhengjie.org.cn ~]# systemctl restart mariadb
  24. [root@yinzhengjie.org.cn ~]#
  25. [root@yinzhengjie.org.cn ~]# systemctl enable mariadb
  26. [root@yinzhengjie.org.cn ~]#
  27. [root@yinzhengjie.org.cn ~]# systemctl list-unit-files | grep mariadb
  28. mariadb.service enabled
  29. mariadb@.service disabled
  30. [root@yinzhengjie.org.cn ~]#
  31. [root@yinzhengjie.org.cn ~]#
  32. [root@yinzhengjie.org.cn ~]# ss -ntl
  33. State Recv-Q Send-Q Local Address:Port Peer Address:Port
  34. LISTEN 127.0.0.53%lo: 0.0.0.0:*
  35. LISTEN 0.0.0.0: 0.0.0.0:*
  36. LISTEN 172.200.5.202: 0.0.0.0:*
  37. LISTEN [::]: [::]:*
  38. [root@yinzhengjie.org.cn ~]#
  39. [root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# sed -i 's#127.0.0.1#172.200.5.202#' /etc/mysql/mariadb.conf.d/50-server.cnf

  1. [root@yinzhengjie.org.cn ~]# cat /etc/mysql/my.cnf
  2. # The MariaDB configuration file
  3. #
  4. # The MariaDB/MySQL tools read configuration files in the following order:
  5. # . "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
  6. # . "/etc/mysql/conf.d/*.cnf" to set global options.
  7. # . "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
  8. # . "~/.my.cnf" to set user-specific options.
  9. #
  10. # If the same option is defined multiple times, the last one will apply.
  11. #
  12. # One can use all long options that the program supports.
  13. # Run program with --help to get a list of available options and with
  14. # --print-defaults to see which it would actually understand and use.
  15.  
  16. #
  17. # This group is read both both by the client and the server
  18. # use it for options that affect everything
  19. #
  20. #
  21.  
  22. #Add by yinzhengjie
  23. [mysqld]
  24. innodb_file_format=BARRACUDA
  25. innodb_large_prefix=true
  26. innodb_default_row_format=DYNAMIC
  27. character-set-server=utf8mb4
  28. collation-server=utf8mb4_unicode_ci
  29.  
  30. [client-server]
  31.  
  32. # Import all .cnf files from configuration directory
  33. !includedir /etc/mysql/conf.d/
  34. !includedir /etc/mysql/mariadb.conf.d/
  35. [root@yinzhengjie.org.cn ~]#

[root@yinzhengjie.org.cn ~]# cat /etc/mysql/my.cnf  #修改MySQL的配置文件,这一步骤千万别忘记,否则你可能会遇到"ERROR 1709 (HY000) at line 89: Index column size too large. The maximum column size is 767 bytes."的报错信息

3>.配置MariaDB数据库授权

  1. [root@yinzhengjie.org.cn ~]# mysql
  2. Welcome to the MariaDB monitor. Commands end with ; or \g.
  3. Your MariaDB connection id is 31
  4. Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
  5.  
  6. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  7.  
  8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  9.  
  10. MariaDB [(none)]>
  11. MariaDB [(none)]> CREATE DATABASE zabbix_server DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  12. Query OK, 1 row affected (0.00 sec)
  13.  
  14. MariaDB [(none)]>
  15. MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix_server.* to zabbix@'172.200.5.%' IDENTIFIED BY 'yinzhengjie';
  16. Query OK, 0 rows affected (0.00 sec)
  17.  
  18. MariaDB [(none)]>
  19. MariaDB [(none)]> QUIT
  20. Bye
  21. [root@yinzhengjie.org.cn ~]#
  22. [root@yinzhengjie.org.cn ~]#
  1. MariaDB [(none)]> SELECT user,host,password FROM mysql.user;
  2. +--------+-------------+-------------------------------------------+
  3. | user | host | password |
  4. +--------+-------------+-------------------------------------------+
  5. | root | localhost | |
  6. | zabbix | 172.200.5.% | *BD0B1F48FDC55BD27555FC2F22FF29A68A25A1D7 |
  7. +--------+-------------+-------------------------------------------+
  8. rows in set (0.00 sec)
  9.  
  10. MariaDB [(none)]>
  11. MariaDB [(none)]>

MariaDB [(none)]> SELECT user,host,password FROM mysql.user;

  1. MariaDB [(none)]> SHOW GRANTS FOR zabbix@'172.200.5.%';
  2. +-----------------------------------------------------------------------------------------------------------------+
  3. | Grants for zabbix@172.200.5.% |
  4. +-----------------------------------------------------------------------------------------------------------------+
  5. | GRANT USAGE ON *.* TO 'zabbix'@'172.200.5.%' IDENTIFIED BY PASSWORD '*BD0B1F48FDC55BD27555FC2F22FF29A68A25A1D7' |
  6. | GRANT ALL PRIVILEGES ON `zabbix_server`.* TO 'zabbix'@'172.200.5.%' |
  7. +-----------------------------------------------------------------------------------------------------------------+
  8. rows in set (0.01 sec)
  9.  
  10. MariaDB [(none)]>

MariaDB [(none)]> SHOW GRANTS FOR zabbix@'172.200.5.%';

四.配置zabbix server服务器 

1>.zabbix server的服务器测试

  1. [root@zabbix203.yinzhengjie.org.cn ~]# apt-get -y install mariadb-client
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. The following additional packages will be installed:
  6. libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1 libmysqlclient20 libterm-readkey-perl mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mysql-common
  7. Suggested packages:
  8. libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
  9. The following NEW packages will be installed:
  10. libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libjemalloc1 libmysqlclient20 libterm-readkey-perl mariadb-client mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mysql-common
  11. upgraded, 12 newly installed, 0 to remove and 136 not upgraded.
  12. Need to get 12.1 MB of archives.
  13. After this operation, 76.2 MB of additional disk space will be used.
  14. Get:1 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 libaio1 amd64 0.3.110-5ubuntu0.1 [6,476 B]
  15. Get:2 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libdbi-perl amd64 1.640-1 [724 kB]
  16. Get:3 http://mirrors.aliyun.com/ubuntu bionic/main amd64 mysql-common all 5.8+1.0.4 [7,308 B]
  17. Get:4 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 libmysqlclient20 amd64 5.7.29-0ubuntu0.18.04.1 [690 kB]
  18. Get:5 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libdbd-mysql-perl amd64 4.046-1 [82.0 kB]
  19. Get:6 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libterm-readkey-perl amd64 2.37-1build1 [24.4 kB]
  20. Get:7 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libconfig-inifiles-perl all 2.94-1 [40.4 kB]
  21. Get:8 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-common all 1:10.1.44-0ubuntu0.18.04.1 [16.1 kB]
  22. Get:9 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-client-core-10.1 amd64 1:10.1.44-0ubuntu0.18.04.1 [4,772 kB]
  23. Get:10 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libjemalloc1 amd64 3.6.0-11 [82.4 kB]
  24. Get:11 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-client-10.1 amd64 1:10.1.44-0ubuntu0.18.04.1 [5,641 kB]
  25. Get:12 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 mariadb-client all 1:10.1.44-0ubuntu0.18.04.1 [12.8 kB]
  26. Fetched 12.1 MB in 2s (6,216 kB/s)
  27. Selecting previously unselected package libaio1:amd64.
  28. (Reading database ... 66992 files and directories currently installed.)
  29. Preparing to unpack .../00-libaio1_0.3.110-5ubuntu0.1_amd64.deb ...
  30. Unpacking libaio1:amd64 (0.3.110-5ubuntu0.1) ...
  31. Selecting previously unselected package libdbi-perl.
  32. Preparing to unpack .../01-libdbi-perl_1.640-1_amd64.deb ...
  33. Unpacking libdbi-perl (1.640-1) ...
  34. Selecting previously unselected package mysql-common.
  35. Preparing to unpack .../02-mysql-common_5.8+1.0.4_all.deb ...
  36. Unpacking mysql-common (5.8+1.0.4) ...
  37. Selecting previously unselected package libmysqlclient20:amd64.
  38. Preparing to unpack .../03-libmysqlclient20_5.7.29-0ubuntu0.18.04.1_amd64.deb ...
  39. Unpacking libmysqlclient20:amd64 (5.7.29-0ubuntu0.18.04.1) ...
  40. Selecting previously unselected package libdbd-mysql-perl.
  41. Preparing to unpack .../04-libdbd-mysql-perl_4.046-1_amd64.deb ...
  42. Unpacking libdbd-mysql-perl (4.046-1) ...
  43. Selecting previously unselected package libterm-readkey-perl.
  44. Preparing to unpack .../05-libterm-readkey-perl_2.37-1build1_amd64.deb ...
  45. Unpacking libterm-readkey-perl (2.37-1build1) ...
  46. Selecting previously unselected package libconfig-inifiles-perl.
  47. Preparing to unpack .../06-libconfig-inifiles-perl_2.94-1_all.deb ...
  48. Unpacking libconfig-inifiles-perl (2.94-1) ...
  49. Selecting previously unselected package mariadb-common.
  50. Preparing to unpack .../07-mariadb-common_1%3a10.1.44-0ubuntu0.18.04.1_all.deb ...
  51. Unpacking mariadb-common (1:10.1.44-0ubuntu0.18.04.1) ...
  52. Selecting previously unselected package mariadb-client-core-10.1.
  53. Preparing to unpack .../08-mariadb-client-core-10.1_1%3a10.1.44-0ubuntu0.18.04.1_amd64.deb ...
  54. Unpacking mariadb-client-core-10.1 (1:10.1.44-0ubuntu0.18.04.1) ...
  55. Selecting previously unselected package libjemalloc1.
  56. Preparing to unpack .../09-libjemalloc1_3.6.0-11_amd64.deb ...
  57. Unpacking libjemalloc1 (3.6.0-11) ...
  58. Selecting previously unselected package mariadb-client-10.1.
  59. Preparing to unpack .../10-mariadb-client-10.1_1%3a10.1.44-0ubuntu0.18.04.1_amd64.deb ...
  60. Unpacking mariadb-client-10.1 (1:10.1.44-0ubuntu0.18.04.1) ...
  61. Selecting previously unselected package mariadb-client.
  62. Preparing to unpack .../11-mariadb-client_1%3a10.1.44-0ubuntu0.18.04.1_all.deb ...
  63. Unpacking mariadb-client (1:10.1.44-0ubuntu0.18.04.1) ...
  64. Setting up libconfig-inifiles-perl (2.94-1) ...
  65. Setting up libjemalloc1 (3.6.0-11) ...
  66. Setting up mysql-common (5.8+1.0.4) ...
  67. update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
  68. Setting up libterm-readkey-perl (2.37-1build1) ...
  69. Processing triggers for libc-bin (2.27-3ubuntu1) ...
  70. Setting up libaio1:amd64 (0.3.110-5ubuntu0.1) ...
  71. Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
  72. Setting up libmysqlclient20:amd64 (5.7.29-0ubuntu0.18.04.1) ...
  73. Setting up libdbi-perl (1.640-1) ...
  74. Setting up mariadb-common (1:10.1.44-0ubuntu0.18.04.1) ...
  75. update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
  76. Setting up mariadb-client-core-10.1 (1:10.1.44-0ubuntu0.18.04.1) ...
  77. Setting up libdbd-mysql-perl (4.046-1) ...
  78. Setting up mariadb-client-10.1 (1:10.1.44-0ubuntu0.18.04.1) ...
  79. Setting up mariadb-client (1:10.1.44-0ubuntu0.18.04.1) ...
  80. Processing triggers for libc-bin (2.27-3ubuntu1) ...
  81. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# apt-get -y install mariadb-client        #需要单独安装MariaDB的客户端

  1. [root@zabbix203.yinzhengjie.org.cn ~]# ifconfig ens33 | sed -nr '2s/^[^0-9]+([0-9.]+).*/\1/p'
  2. 172.200.5.203
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# mysql -u zabbix -pyinzhengjie -h 172.200.5.202
  5. Welcome to the MariaDB monitor. Commands end with ; or \g.
  6. Your MariaDB connection id is 51
  7. Server version: 10.1.44-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
  8.  
  9. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  10.  
  11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  12.  
  13. MariaDB [(none)]>
  14. MariaDB [(none)]> SHOW DATABASES;
  15. +--------------------+
  16. | Database |
  17. +--------------------+
  18. | information_schema |
  19. | zabbix_server |
  20. +--------------------+
  21. 2 rows in set (0.00 sec)
  22.  
  23. MariaDB [(none)]>
  24. MariaDB [(none)]> USE zabbix_server
  25. Database changed
  26. MariaDB [zabbix_server]>
  27. MariaDB [zabbix_server]> SHOW TABLES;
  28. Empty set (0.00 sec)
  29.  
  30. MariaDB [zabbix_server]>
  31. MariaDB [zabbix_server]> QUIT
  32. Bye
  33. [root@zabbix203.yinzhengjie.org.cn ~]#
  34. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# mysql -u zabbix -pyinzhengjie -h 172.200.5.202

2>.初始化zabbix server的数据库信息

  1. [root@zabbix203.yinzhengjie.org.cn ~]# ll /usr/local/src/zabbix-4.0.17/database/
  2. total 84
  3. drwxr-xr-x 8 1001 1001 4096 Feb 14 06:20 ./
  4. drwxr-xr-x 13 1001 1001 4096 Feb 14 06:20 ../
  5. drwxr-xr-x 2 1001 1001 4096 Jan 28 14:36 elasticsearch/
  6. drwxr-xr-x 2 1001 1001 4096 Feb 14 06:20 ibm_db2/
  7. -rw-r--r-- 1 root root 21640 Feb 14 06:20 Makefile
  8. -rw-r--r-- 1 1001 1001 155 Jan 28 14:36 Makefile.am
  9. -rw-r--r-- 1 1001 1001 21722 Jan 28 14:36 Makefile.in
  10. drwxr-xr-x 2 1001 1001 4096 Feb 14 06:20 mysql/
  11. drwxr-xr-x 2 1001 1001 4096 Feb 14 06:20 oracle/
  12. drwxr-xr-x 2 1001 1001 4096 Feb 14 06:20 postgresql/
  13. drwxr-xr-x 2 1001 1001 4096 Feb 14 06:20 sqlite3/
  14. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# ll /usr/local/src/zabbix-4.0.17/database/

  1. [root@zabbix203.yinzhengjie.org.cn ~]# ll /usr/local/src/zabbix-4.0.17/database/mysql/
  2. total 6100
  3. drwxr-xr-x 2 1001 1001 4096 Feb 14 06:20 ./
  4. drwxr-xr-x 8 1001 1001 4096 Feb 14 06:20 ../
  5. -rw-r--r-- 1 1001 1001 4079333 Jan 28 14:36 data.sql
  6. -rw-r--r-- 1 1001 1001 1978341 Jan 28 14:36 images.sql
  7. -rw-r--r-- 1 root root 15586 Feb 14 06:20 Makefile
  8. -rw-r--r-- 1 1001 1001 392 Jan 28 14:36 Makefile.am
  9. -rw-r--r-- 1 1001 1001 15711 Jan 28 14:36 Makefile.in
  10. -rw-r--r-- 1 1001 1001 140265 Jan 28 14:36 schema.sql
  11. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# ll /usr/local/src/zabbix-4.0.17/database/mysql/

  1. [root@zabbix203.yinzhengjie.org.cn ~]# ifconfig ens33 | sed -nr '2s/^[^0-9]+([0-9.]+).*/\1/p'
  2. 172.200.5.203
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# mysql -u zabbix -pyinzhengjie -h 172.200.5.202 zabbix_server < /usr/local/src/zabbix-4.0./database/mysql/schema.sql
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# mysql -u zabbix -pyinzhengjie -h 172.200.5.202 zabbix_server < /usr/local/src/zabbix-4.0./database/mysql/images.sql
  7. [root@zabbix203.yinzhengjie.org.cn ~]#
  8. [root@zabbix203.yinzhengjie.org.cn ~]# mysql -u zabbix -pyinzhengjie -h 172.200.5.202 zabbix_server < /usr/local/src/zabbix-4.0./database/mysql/data.sql
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

3>.修改zabbix的配置文件

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep DBHost= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  2. # DBHost=localhost
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's@# (DBHost=)localhost@\1172.200.5.202@' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep DBHost= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  7. DBHost=172.200.5.202
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's@# (DBHost=)localhost@\1172.200.5.202@' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep DBPort= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  2. # DBPort=
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's@# (DBPort=)@\13306@' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep DBPort= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  7. DBPort=
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's@# (DBPort=)@\13306@' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep ^DBName= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  2. DBName=zabbix
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(DBName=)zabbix#\1zabbix_server#' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep ^DBName= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  7. DBName=zabbix_server
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(DBName=)zabbix#\1zabbix_server#' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep DBPassword= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  2. # DBPassword=
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's@# (DBPassword=)@\1yinzhengjie@' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep DBPassword= /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  7. DBPassword=yinzhengjie
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's@# (DBPassword=)@\1yinzhengjie@' /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep "^D" /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf
  2. DBHost=172.200.5.202
  3. DBName=zabbix_server
  4. DBUser=zabbix
  5. DBPassword=yinzhengjie
  6. DBPort=
  7. [root@zabbix203.yinzhengjie.org.cn ~]#
  8. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# grep "^D" /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf

4>.创建zabbix用户用来运行zabbix server的守护进程

  1. [root@zabbix203.yinzhengjie.org.cn ~]# groupadd zabbix
  2. [root@zabbix203.yinzhengjie.org.cn ~]#
  3. [root@zabbix203.yinzhengjie.org.cn ~]# useradd zabbix -s /sbin/nologin -M -g zabbix
  4. [root@zabbix203.yinzhengjie.org.cn ~]#
  5. [root@zabbix203.yinzhengjie.org.cn ~]# chown zabbix:zabbix /yinzhengjie/softwares/zabbix/ -R
  6. [root@zabbix203.yinzhengjie.org.cn ~]#
  7. [root@zabbix203.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/zabbix/ -d
  8. drwxr-xr-x zabbix zabbix Feb : /yinzhengjie/softwares/zabbix//
  9. [root@zabbix203.yinzhengjie.org.cn ~]#
  10. [root@zabbix203.yinzhengjie.org.cn ~]# ll /yinzhengjie/softwares/zabbix/
  11. total
  12. drwxr-xr-x zabbix zabbix Feb : ./
  13. drwxr-xr-x root root Feb : ../
  14. drwxr-xr-x zabbix zabbix Feb : bin/
  15. drwxr-xr-x zabbix zabbix Feb : etc/
  16. drwxr-xr-x zabbix zabbix Feb : lib/
  17. drwxr-xr-x zabbix zabbix Feb : sbin/
  18. drwxr-xr-x zabbix zabbix Feb : share/
  19. [root@zabbix203.yinzhengjie.org.cn ~]#
  20. [root@zabbix203.yinzhengjie.org.cn ~]#

5>.启动zabbix server服务器

  1. [root@zabbix203.yinzhengjie.org.cn ~]# /yinzhengjie/softwares/zabbix/sbin/zabbix_server -h
  2. usage:
  3. zabbix_server [-c config-file]
  4. zabbix_server [-c config-file] -R runtime-option
  5. zabbix_server -h
  6. zabbix_server -V
  7.  
  8. The core daemon of Zabbix software.
  9.  
  10. Options:
  11. -c --config config-file Path to the configuration file
  12. (default: "/yinzhengjie/softwares/zabbix/etc/zabbix_server.conf")
  13. -f --foreground Run Zabbix server in foreground
  14. -R --runtime-control runtime-option Perform administrative functions
  15.  
  16. Runtime control options:
  17. config_cache_reload Reload configuration cache
  18. housekeeper_execute Execute the housekeeper
  19. log_level_increase=target Increase log level, affects all processes if
  20. target is not specified
  21. log_level_decrease=target Decrease log level, affects all processes if
  22. target is not specified
  23.  
  24. Log level control targets:
  25. process-type All processes of specified type
  26. (alerter, alert manager, configuration syncer,
  27. discoverer, escalator, history syncer,
  28. housekeeper, http poller, icmp pinger,
  29. ipmi manager, ipmi poller, java poller,
  30. poller, preprocessing manager,
  31. preprocessing worker, proxy poller,
  32. self-monitoring, snmp trapper, task manager,
  33. timer, trapper, unreachable poller,
  34. vmware collector)
  35. process-type,N Process type and number (e.g., poller,)
  36. pid Process identifier, up to . For larger
  37. values specify target as "process-type,N"
  38.  
  39. -h --help Display this help message
  40. -V --version Display version number
  41.  
  42. Some configuration parameter default locations:
  43. AlertScriptsPath "/yinzhengjie/softwares/zabbix/share/zabbix/alertscripts"
  44. ExternalScripts "/yinzhengjie/softwares/zabbix/share/zabbix/externalscripts"
  45. SSLCertLocation "/yinzhengjie/softwares/zabbix/share/zabbix/ssl/certs"
  46. SSLKeyLocation "/yinzhengjie/softwares/zabbix/share/zabbix/ssl/keys"
  47. LoadModulePath "/yinzhengjie/softwares/zabbix/lib/modules"
  48.  
  49. Report bugs to: <https://support.zabbix.com>
  50. Zabbix home page: <http://www.zabbix.com>
  51. Documentation: <https://www.zabbix.com/documentation>
  52. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# /yinzhengjie/softwares/zabbix/sbin/zabbix_server -h

  1. [root@zabbix203.yinzhengjie.org.cn ~]# /yinzhengjie/softwares/zabbix/sbin/zabbix_server -c /yinzhengjie/softwares/zabbix/etc/zabbix_server.conf

五.配置zabbix web

1>.安装apache及php环境

  1. [root@zabbix203.yinzhengjie.org.cn ~]# apt -y install apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu-core fping javascript-common libapache2-mod-php7. libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libblas3 libfontconfig1 libgd3 libiksemel3 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-jquery-ui libjs-prototype liblinear3 libltdl7 liblua5.- liblua5.- libodbc1 libopenipmi0 libpq5 libsensors4 libsnmp-base libsnmp30 libsodium23 libssh2- libtiff5 libwebp6 libxpm4 nmap php php-bcmath php-common php-gd php-ldap php-mbstring php-pgsql php-xml php7. php7.-bcmath php7.-cli php7.-common php7.-gd php7.-json php7.-ldap php7.-mbstring php7.-opcache php7.-pgsql php7.-readline php7.-xml snmpd ssl-cert traceroute ttf-dejavu-core

2>.将前端的PHP代码拷贝到apache的根目录(当然,你也可以在根目录下创建一个"zabbix"目录,并将代码放在里面)

3>.访问zabbix web界面(http://zabbix203.yinzhengjie.org.cn/setup.php)

4>.如果不修改php的默认配置文件,则会检测参数异常,如下图所示

5>.修改php的配置文件并重启web服务器使得配置生效

  1. [root@zabbix203.yinzhengjie.org.cn ~]# find / -name php.ini
  2. /etc/php/7.2/cli/php.ini
  3. /etc/php/7.2/apache2/php.ini
  4. [root@zabbix203.yinzhengjie.org.cn ~]#
  5. [root@zabbix203.yinzhengjie.org.cn ~]# cp /etc/php/7.2/apache2/php.ini /etc/php/7.2/apache2/php.ini-`date +%F`          #修改前记得备份配置文件哈~
  6. [root@zabbix203.yinzhengjie.org.cn ~]#
  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep post_max_size /etc/php/7.2/apache2/php.ini
  2. post_max_size = 8M
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(post_max_size =) 8#\1 16#' /etc/php/7.2/apache2/php.ini
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep post_max_size /etc/php/7.2/apache2/php.ini
  7. post_max_size = 16M
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(post_max_size =) 8#\1 16#' /etc/php/7.2/apache2/php.ini

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep max_execution_time /etc/php/7.2/apache2/php.ini
  2. max_execution_time =
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(max_execution_time =) 30#\1 300#' /etc/php/7.2/apache2/php.ini
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep max_execution_time /etc/php/7.2/apache2/php.ini
  7. max_execution_time =
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(max_execution_time =) 30#\1 300#' /etc/php/7.2/apache2/php.ini

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep "max_input_time =" /etc/php/7.2/apache2/php.ini
  2. max_input_time =
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(max_input_time =) 60#\1 300#' /etc/php/7.2/apache2/php.ini
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep "max_input_time =" /etc/php/7.2/apache2/php.ini
  7. max_input_time =
  8. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#(max_input_time =) 60#\1 300#' /etc/php/7.2/apache2/php.ini

  1. [root@zabbix203.yinzhengjie.org.cn ~]# grep "date.timezone =" /etc/php/7.2/apache2/php.ini
  2. ;date.timezone =
  3. [root@zabbix203.yinzhengjie.org.cn ~]#
  4. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#;(date.timezone =)#\1 Asia/Shanghai#' /etc/php/7.2/apache2/php.ini
  5. [root@zabbix203.yinzhengjie.org.cn ~]#
  6. [root@zabbix203.yinzhengjie.org.cn ~]# grep "date.timezone =" /etc/php/7.2/apache2/php.ini
  7. date.timezone = Asia/Shanghai
  8. [root@zabbix203.yinzhengjie.org.cn ~]#
  9. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#;(date.timezone =)#\1 Asia/Shanghai#' /etc/php/7.2/apache2/php.ini

6>.配置数据库信息

  1.   如果没有安装mysql驱动的话,默认是不支持MySQL数据库类型的,如下图所示。

  1. [root@zabbix203.yinzhengjie.org.cn ~]# apt -y install php-gettext php-xml php-net-socket php-gd php-mysql
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. php-gd is already the newest version (:7.2+60ubuntu1).
  6. php-xml is already the newest version (:7.2+60ubuntu1).
  7. The following additional packages will be installed:
  8. php-pear php-php-gettext php7.-mysql
  9. The following NEW packages will be installed:
  10. php-gettext php-mysql php-net-socket php-pear php-php-gettext php7.-mysql
  11. upgraded, newly installed, to remove and not upgraded.
  12. Need to get kB of archives.
  13. After this operation, , kB of additional disk space will be used.
  14. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 php-pear all 1:1.10.5+submodules+notgz-1ubuntu1.18.04.1 [284 kB]
  15. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 php-php-gettext all 1.0.12-0.1 [16.2 kB]
  16. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 php-gettext all 1.0.12-0.1 [1,508 B]
  17. Get: http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 php7.2-mysql amd64 7.2.24-0ubuntu0.18.04.2 [117 kB]
  18. Get: http://mirrors.aliyun.com/ubuntu bionic/main amd64 php-mysql all 1:7.2+60ubuntu1 [2,004 B]
  19. Get: http://mirrors.aliyun.com/ubuntu bionic/universe amd64 php-net-socket all 1.0.14-2 [10.2 kB]
  20. Fetched kB in 1s ( kB/s)
  21. Selecting previously unselected package php-pear.
  22. (Reading database ... files and directories currently installed.)
  23. Preparing to unpack .../-php-pear_1%3a1.10.5+submodules+notgz-1ubuntu1.18.04.1_all.deb ...
  24. Unpacking php-pear (:1.10.+submodules+notgz-1ubuntu1.18.04.) ..........................................................................................................................................................................................................]
  25. Selecting previously unselected package php-php-gettext...................................................................................................................................................................................................................]
  26. Preparing to unpack .../-php-php-gettext_1.0.12-.1_all.deb ...
  27. Unpacking php-php-gettext (1.0.-0.1) ...########........................................................................................................................................................................................................................]
  28. Selecting previously unselected package php-gettext.##############........................................................................................................................................................................................................]
  29. Preparing to unpack .../-php-gettext_1.0.12-.1_all.deb ...
  30. Unpacking php-gettext (1.0.-0.1) ...####################################................................................................................................................................................................................................]
  31. Selecting previously unselected package php7.-mysql.#####################################................................................................................................................................................................................]
  32. Preparing to unpack .../-php7.-mysql_7.2.24-0ubuntu0.18.04.2_amd64.deb ...
  33. Unpacking php7.-mysql (7.2.-0ubuntu0.18.04.) ...##############################################........................................................................................................................................................................]
  34. Selecting previously unselected package php-mysql.################################################################........................................................................................................................................................]
  35. Preparing to unpack .../-php-mysql_1%3a7.+60ubuntu1_all.deb ...
  36. Unpacking php-mysql (:7.2+60ubuntu1) ...#################################################################################................................................................................................................................................]
  37. Selecting previously unselected package php-net-socket.###################################################################################................................................................................................................................]
  38. Preparing to unpack .../-php-net-socket_1.0.14-2_all.deb ...
  39. Unpacking php-net-socket (1.0.-) ...###########################################################################################################........................................................................................................................]
  40. Setting up php7.-mysql (7.2.-0ubuntu0.18.04.) ...#############################################################################################################........................................................................................................]
  41. Progress: [ %] [########################################################################################################################################################................................................................................................]
  42. Creating config file /etc/php/7.2/mods-available/mysqlnd.ini with new version
  43.  
  44. Creating config file /etc/php/7.2/mods-available/mysqli.ini with new version
  45.  
  46. Creating config file /etc/php/7.2/mods-available/pdo_mysql.ini with new version
  47. Setting up php-net-socket (1.0.-) ...##########################################################################################################################################........................................................................................]
  48. Setting up php-pear (:1.10.+submodules+notgz-1ubuntu1.18.04.) ...##############################################################################################################################........................................................................]
  49. Processing triggers for man-db (2.8.-2ubuntu0.) ...#############################################################################################################################################################........................................................]
  50. Processing triggers for libapache2-mod-php7. (7.2.-0ubuntu0.18.04.) ...
  51. Setting up php-mysql (:7.2+60ubuntu1) ...
  52. Setting up php-php-gettext (1.0.-0.1) ...#######################################################################################################################################################################################........................................]
  53. Setting up php-gettext (1.0.-0.1) ...###########################################################################################################################################################################################################........................]
  54. [root@zabbix203.yinzhengjie.org.cn ~]#

[root@zabbix203.yinzhengjie.org.cn ~]# apt -y install php-gettext php-xml php-net-socket php-gd php-mysql

  1. [root@zabbix203.yinzhengjie.org.cn ~]# systemctl restart apache2            #安装上述的php相关程序包后,别忘记重启apache2服务哟~重启后刷新页面就可以选择MySQL类型了,填写对应的参数即可,如下图所示。

7>.填写zabbix的信息

8>.安装zabbix web前的最后确认

9>.创建zabbix web的配置文件失败,我们需要手动上传

10>.根据上一步的提示信息将文件下载后上传到服务器指定位置并修改相应的权限

  1. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# cat zabbix.conf.php
  2. <?php
  3. // Zabbix GUI configuration file.
  4. global $DB;
  5.  
  6. $DB['TYPE'] = 'MYSQL';
  7. $DB['SERVER'] = '172.200.5.202';
  8. $DB['PORT'] = '';
  9. $DB['DATABASE'] = 'zabbix_server';
  10. $DB['USER'] = 'zabbix';
  11. $DB['PASSWORD'] = 'yinzhengjie';
  12.  
  13. // Schema name. Used for IBM DB2 and PostgreSQL.
  14. $DB['SCHEMA'] = 'za';
  15.  
  16. $ZBX_SERVER = '172.200.5.203';
  17. $ZBX_SERVER_PORT = '';
  18. $ZBX_SERVER_NAME = 'Yinzhengjie\'s Zabbix Server';
  19.  
  20. $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
  21. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#

[root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# cat zabbix.conf.php

  1. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# ll
  2. total
  3. drwxr-xr-x zabbix zabbix Feb : ./
  4. drwxr-xr-x root root Feb : ../
  5. -rw-r--r-- zabbix zabbix Jan : .htaccess
  6. -rw-r--r-- zabbix zabbix Jan : maintenance.inc.php
  7. -rw-r--r-- root root Feb : zabbix.conf.php
  8. -rw-r--r-- zabbix zabbix Jan : zabbix.conf.php.example
  9. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#
  10. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# cat zabbix.conf.php
  11. <?php
  12. // Zabbix GUI configuration file.
  13. global $DB;
  14.  
  15. $DB['TYPE'] = 'MYSQL';
  16. $DB['SERVER'] = '172.200.5.202';
  17. $DB['PORT'] = '';
  18. $DB['DATABASE'] = 'zabbix_server';
  19. $DB['USER'] = 'zabbix';
  20. $DB['PASSWORD'] = 'yinzhengjie';
  21.  
  22. // Schema name. Used for IBM DB2 and PostgreSQL.
  23. $DB['SCHEMA'] = 'za';
  24.  
  25. $ZBX_SERVER = '172.200.5.203';
  26. $ZBX_SERVER_PORT = '';
  27. $ZBX_SERVER_NAME = 'Yinzhengjie\'s Zabbix Server';
  28.  
  29. $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
  30. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#
  31. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# chown zabbix:zabbix zabbix.conf.php
  32. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#
  33. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#
  34. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# ll
  35. total
  36. drwxr-xr-x zabbix zabbix Feb : ./
  37. drwxr-xr-x root root Feb : ../
  38. -rw-r--r-- zabbix zabbix Jan : .htaccess
  39. -rw-r--r-- zabbix zabbix Jan : maintenance.inc.php
  40. -rw-r--r-- zabbix zabbix Feb : zabbix.conf.php
  41. -rw-r--r-- zabbix zabbix Jan : zabbix.conf.php.example
  42. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#
  43. [root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]#

[root@zabbix203.yinzhengjie.org.cn /var/www/html/conf]# chown zabbix:zabbix zabbix.conf.php

11>.zabbix前端安装完成

12>.登录zabbix的WebUI页面

13>.配置zabbix web对中文支持

  1.   博主推荐阅读:
  2.     https://www.cnblogs.com/yinzhengjie2020/p/12305904.html

 14>.解决中文乱码问题

  1. [root@zabbix203.yinzhengjie.org.cn ~]# ll /var/www/html/assets/fonts/
  2. total
  3. drwxr-xr-x zabbix zabbix Jan : ./
  4. drwxr-xr-x zabbix zabbix Jan : ../
  5. -rw-r--r-- zabbix zabbix Jan : DejaVuSans.ttf
  6. [root@zabbix203.yinzhengjie.org.cn ~]#
  7. [root@zabbix203.yinzhengjie.org.cn ~]# cd /var/www/html/assets/fonts/
  8. [root@zabbix203.yinzhengjie.org.cn /var/www/html/assets/fonts]#
  9. [root@zabbix203.yinzhengjie.org.cn /var/www/html/assets/fonts]# rz
  10.  
  11. [root@zabbix203.yinzhengjie.org.cn /var/www/html/assets/fonts]#
  12. [root@zabbix203.yinzhengjie.org.cn /var/www/html/assets/fonts]# ll
  13. total
  14. drwxr-xr-x zabbix zabbix Feb : ./
  15. drwxr-xr-x zabbix zabbix Jan : ../
  16. -rw-r--r-- zabbix zabbix Jan : DejaVuSans.ttf
  17. -rw-r--r-- root root Mar simkai.ttf
  18. [root@zabbix203.yinzhengjie.org.cn /var/www/html/assets/fonts]#
  19. [root@zabbix203.yinzhengjie.org.cn /var/www/html/assets/fonts]# cd
  20. [root@zabbix203.yinzhengjie.org.cn ~]#
  21. [root@zabbix203.yinzhengjie.org.cn ~]# grep -i DejaVuSans /var/www/html/include/defines.inc.php
  22. define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
  23. define('ZBX_FONT_NAME', 'DejaVuSans');
  24. [root@zabbix203.yinzhengjie.org.cn ~]#
  25. [root@zabbix203.yinzhengjie.org.cn ~]# sed -r -i 's#DejaVuSans#simkai#' /var/www/html/include/defines.inc.php
  26. [root@zabbix203.yinzhengjie.org.cn ~]#
  27. [root@zabbix203.yinzhengjie.org.cn ~]# grep -i simkai /var/www/html/include/defines.inc.php
  28. define('ZBX_GRAPH_FONT_NAME', 'simkai'); // font file name
  29. define('ZBX_FONT_NAME', 'simkai');
  30. [root@zabbix203.yinzhengjie.org.cn ~]#
  31. [root@zabbix203.yinzhengjie.org.cn ~]#

六.启动zabbix agent服务

1>.查看zabbix的主界面

2>.点击"配置" ---> "主机",查看主机的状态

3>.手动启动zabbix agent

4>.再次查看zabbix WebUI

5>.查看zabbix的主界面

6>.编写zabbix的启动管理脚本

  1.   博主推荐阅读:
  2.     https://www.cnblogs.com/yinzhengjie2020/p/12306215.html

使用Ubuntu系统编译安装Zabbix企业级监控系统的更多相关文章

  1. 使用Ubuntu系统管理包工具(apt)部署Zabbix企业级监控系统

    使用Ubuntu系统管理包工具(apt)部署Zabbix企业级监控系统  作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Ubuntu系统部署笔记:https://www.cnblo ...

  2. Ubuntu操作系统编译安装zabbix报错汇总

    Ubuntu操作系统编译安装zabbix报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.报错提示:"configure: error: MySQL libra ...

  3. RHEL6 最小化系统 编译安装部署zabbix (mysql)

    RHEL6 最小化系统 编译安装部署zabbix (mysql)官方说明详细见:https://www.zabbix.com/documentation/4.0/manual/installation ...

  4. zabbix企业级监控概述和部署

    官方网站:http://www.zabbix.com/ zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案 zabbix能监视各种网络参数,保证服务器系统的安全 ...

  5. Zabbix分布式监控系统实践

    https://www.zabbix.com/wiki/howto/install/Ubuntu/ubuntuinstall 环境介绍OS: Ubuntu 10.10 Server 64-bitSer ...

  6. 互联网企业级监控系统 OpenFalcon

    Open-Falcon 人性化的互联网企业级监控系统,Open-Falcon 整体可以分为两部分,即绘图组件.告警组件.其中: 安装绘图组件 负责数据的采集.收集.存储.归档.采样.查询.展示(Das ...

  7. 编译安装zabbix 3.0及分开部署配置详解

    实验系统:CentOS 6.6_x86_64 实验前提:提前准备好编译环境,防火墙和selinux都关闭 实验说明:本实验共有4台主机,IP及角色分配如拓扑 下载地址:试验中用到mariadb软件的下 ...

  8. Ubuntu下编译安装postgreSQL 10.5

    Ubuntu下编译安装postgreSQL 10.5 ubuntu 16.04 LTS系统postgreSQL 10.5 安装包准备 1.从PostgreSQL官网下载PostgreSQL的安装包 安 ...

  9. 在Ubuntu下编译安装GreatSQL

    在Ubuntu下编译安装GreatSQL 本次介绍如何利用Docker构建Ubuntu环境,并将GreatSQL源码编译成二进制文件. 1.准备工作 先创建本次Docker的workdir为 /dat ...

随机推荐

  1. 转:HttpClient使用详解

    一.使用方法 使用HttpClient发送请求.接收响应很简单,一般需要如下几步即可. 1. 创建HttpClient对象. 2. 创建请求方法的实例,并指定请求URL.如果需要发送GET请求,创建H ...

  2. 基础总结篇之八:创建及调用自己的ContentProvider

    转自:http://blog.csdn.net/wellsoho/article/details/49494141 若不能坚持到底,即使是朽木也不能折断:只要坚持不停地用刀刻,就算是金属玉石也可以雕出 ...

  3. 解决sublime不能安装packages的问题

    问题如下:该问题产生的原因是因为默认的配置中无法访问 "https://packagecontrol.io/channel_v3.json"该文件造成的 解决: 1.下载 chan ...

  4. 研究Zookeeper的原理(二)

    阅读声明:以下内容是结合网上材料及工作内容所写的个人理解,如有不当,欢迎大家指正~~~谢谢啦 一.ZooKeeper的选举机制.FailOver机制 我们知道ZooKeeper在分布式环境中协调服务, ...

  5. 简单bat脚本

    hwf.bat: set GAP_HOME=%~dp0\.. ::copy "%JAVA_HOME%\bin\javaw.exe" "%JAVA_HOME%\bin\HW ...

  6. ha-wordy-Write-up

    信息收集 下载地址:点我 bilibili:点我 ➜ ~ nmap -sn 192.168.116.1/24 Starting Nmap 7.80 ( https://nmap.org ) at 20 ...

  7. PageObject

    import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import o ...

  8. centos将uwsgi添加为系统服务

    如果退出ssh 链接, 都会导致uwsgi进程关闭 这时, 我们需要进行管理软件管理uwsgi进行的运行, centos系统中我们采用 systemd, 让我们的项目变为系统服务 第一步: 首先 vi ...

  9. 【转】PowerDesigner数据库视图同时显示Code和Name

    1.按顺序打开: Tools>>>Display Preference 2.依次点击 选中Code打钩,并点击箭头指向图标把Code置顶 3.最终效果图 原文链接

  10. Netcat - 网络工具中的瑞士军刀

    nc的一些小应用,慢更新.... 1.一个简单的聊天工具,Client1和Client2之间,Client1安装了nc,监听8888端口,Client2用telnet Client1的8888端口即可 ...