服务器之家

服务器之家 > 正文

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

时间:2021-07-26 15:53     来源/作者:RaySo

1    安装前准备:

1.1   安装jdk

卸载openjdk

?
1
2
3
# rpm -qa | grep java
# yum remove java-1.8.0-openjdk
# yum remove java-1.8.0-openjdk-headless

安装jdk包

# rpm -ivh jdk-8u191-linux-x64.rpm

1.2   安装依赖包

?
1
# yum install -y net-snmp net-snmp-devel openipmi-devel libssh2-devel openldap-devel openldap-clients libxml2-devel libcurl-devel gcc msyql-devel libevent-devel php-mysql php-gd php-mbstring php-bcmath libjpeg-devel freetype-devel libpng-devel php-xml keyutils-libs-devel krb5-devel libcom_err-devel libkadm5 libselinux-devel libsepol-devel openssl-devel pcre-devel zlib-devel

以下3个包在dvd1中没有包含,如果配置的是本地yum源,需要单独安装

?
1
2
3
# yum install -y libevent-devel-2.0.21-4.el7.x86_64.rpm
# yum install -y libssh2-devel-1.4.3-12.el7.x86_64.rpm
# yum install -y openipmi-devel-2.0.23-2.el7.x86_64.rpm

安装完依赖包以后可以使用以下命令检查是否都安装成功

?
1
# rpm -qa net-snmp net-snmp-devel openipmi-devel libssh2-devel openldap-devel openldap-clients libxml2-devel libcurl-devel gcc msyql-devel libevent-devel php-mysql php-gd php-mbstring php-bcmath libjpeg-devel freetype-devel libpng-devel php-xml keyutils-libs-devel krb5-devel libcom_err-devel libkadm5 libselinux-devel libsepol-devel openssl-devel pcre-devel zlib-devel

1.3   安装mysql

详见mysql安装文档

1.4   安装nginx

?
1
2
3
4
# tar -zxvf nginx-1.14.0.tar.gz -c /home
# cd /home/nginx-1.14.0/
# ./configure
# make & make install

1.5   安装php

?
1
2
# yum install -y php
# yum install -y php-fpm-5.4.16-46.el7.x86_64.rpm

2    安装服务:

2.1   编译安装zabbix

?
1
2
3
4
5
6
# groupadd --system zabbix
# useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin zabbix
# tar -zxvf zabbix-4.0.4.tar.gz -c /home
# cd /home/zabbix-4.0.4/
# ./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-ldap --with-ssh2 --with-openipmi --enable-java --with-openssl
# make install

2.2   创建数据库

?
1
2
3
4
5
6
7
8
# mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@"serverip" identified by '<password>';
mysql> quit
# cd /home/zabbix-4.0.4/database/mysql
# mysql -uzabbix -p<password> zabbix < schema.sql
# mysql -uzabbix -p<password> zabbix < images.sql
# mysql -uzabbix -p<password> zabbix < data.sql

2.3   修改配置

?
1
2
# vim /usr/local/zabbix/etc/zabbix_server.conf
dbpassword=<password>

2.4   启动服务

?
1
2
3
# /usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
# /usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf
# /usr/local/zabbix/sbin/zabbix_java/startup.sh

注:/usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: no such file or directory

报以上错误的处理方案:

?
1
2
3
4
# find / -name libmysqlclient.so.20
/home/mysql/lib/libmysqlclient.so.20
# echo "/home/mysql/lib" >> /etc/ld.so.conf
# ldconfig

然后重新启动服务

3    安装前端:

3.1   配置nginx

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# vim /usr/local/nginx/conf/nginx.conf
server {
    listen    80;
    server_name localhost;
    proxy_buffer_size 128k;
    proxy_buffers 32 32k;
    client_header_buffer_size 64k;
    large_client_header_buffers 8 128k;
    access_log /usr/local/nginx/logs/zabbix.access.log main;
    error_log /usr/local/nginx/logs/zabbix.error.log error;
    location / {
      root  html;
      index index.php index.htm;
    }
    error_page  500 502 503 504 /50x.html;
    location = /50x.html {
      root  html;
    }
    location ~ \.php$ {
      fastcgi_buffer_size 128k;
      fastcgi_buffers 32 32k;
      fastcgi_pass  unix:/var/run/php-fpm/php-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param script_filename /scripts$fastcgi_script_name;
      include    fastcgi_params;
      include    fastcgi.conf;
    }
}

注:去掉上面 log_format 的注释

3.2   配置php

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# vim /etc/php.ini
max_execution_time = 300
memory_limit = 128m
post_max_size = 16m
upload_max_filesize = 2m
max_input_time = 300
date.timezone = asia/shanghai
# vim /etc/php-fpm.d/www.conf
[www]
listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock
listen.mode = 0666
user = nobody
group = nobody
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

3.3   复制静态文件

?
1
2
3
# rm -rf /usr/local/nginx/html/*
# cp -rf /home/zabbix-4.0.4/frontends/php/* /usr/local/nginx/html/
# chown -r nobody.nobody /usr/local/nginx/html

3.4   配置前端

访问所部署服务的web地址

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

检测依赖,缺少的模块请安装。dvd2中找到相应的rpm包进行安装,重启php-fpm(kill -usr2 php-fpm:master的pid)

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

配置数据库

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

配置服务器

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

 完成安装。

默认的用户名:admin,密码:zabbix

总结

以上所述是小编给大家介绍的zabbix 4.04 安装文档教程详解(基于centos 7.6),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

原文链接:https://www.cnblogs.com/rayso/archive/2020/01/03/12143169.html

标签:

相关文章

热门资讯

2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
yue是什么意思 网络流行语yue了是什么梗
yue是什么意思 网络流行语yue了是什么梗 2020-10-11
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总 2020-11-13
2021德云社封箱演出完整版 2021年德云社封箱演出在线看
2021德云社封箱演出完整版 2021年德云社封箱演出在线看 2021-03-15
返回顶部