前端篇

前置操作 1、关闭防火墙 systemctl stop firewalld systemctl disable firewalld 2、关闭selinx setenforce 0 附:查看selinux的命令及永久关闭selinux getenforce vi /etc/sysconfig/selinux SELINUX=enforcing 改为 SELINUX=disabled 3、添加域名解析 在/etc/hosts当中添加一条记录(主机ip地址加域名) 192.168.1.5 zabbix.server

一、基础配置 1、使用某里巴巴的镜像源来加速操作系统的软件包安装 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 2、安装epel-release源(包含了基础镜像不包含的工具包) yum groups install epel-release 3、安装常用开发组件development tool yum groups install "Development Tools" 附:查看Development Tool 包含的工具包命令(yum groups info “Development Tools") 4、添加zabbix的镜像源 rpm -ivh https://repo.zabbix.com/zabbix/4 ... .0-1.el7.noarch.rpm 5、重启 reboot

二、安装zabbix-server及相关rpm包 1、安装zabbix-server-mysql(服务端) yum install zabbix-server-mysql 2、安装zabbix-web-mysql(前端) yum install zabbix-web-mysql 3、安装mariadb-server(数据库服务) yum install mariadb-server

三、初始化mariadb-server 1、启动mariadb systemctl start mariadb 附:查看mariadb的状态、进程、自启动 systemctl status mariadb ps aux | grep mysqlchkconfig mariadb on2、初始化mariadb mysql_secure_installation (1)Enter current password for root (enter for none): 回车键 (2)Set root password? [Y/n] (设置root密码):n (3)Remove anonymous users? [Y/n] 是否移除匿名用户:y (4)Disallow root login remotely? [Y/n] 是否禁止root登陆:n (5)Remove test database and access to it? [Y/n]是否删除测试数据库:y (6)Reload privilege tables now? [Y/n]是否重新加载权限:y

四、创建数据库zabbix 1、进入数据库 mysql -uroot -p Enter password: 回车键 2、创建数据库zabbix,字符集为utf8 MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; 附:显示数据库zabbix MariaDB [(none)]>show databases; 3、授予用户localhost密码findsec123在数据库zabbix上所有权限 MariaDB [(none)]>grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix@findsec123'; 4、更新权限表 MariaDB [(none)]> flush privileges; 5、退出数据库 MariaDB [(none)]> quit; 6、导入数据结构 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix@findsec123 zabbix 附:查看导入的表 (1)进入数据库 mysql -uroot -p (2)使用数据库zabbix MariaDB [(none)]> use zabbix; (3)显示数据库zabbix中的表 MariaDB [zabbix]> show tables;

五、修改zabbix-server的配置文件 vi /etc/zabbix/zabbix_server.conf DBHost=localhost(数据库主机名=本地主机) DBName=zabbix(数据库名=zabbix) DBUser=zabbix(数据库用户名=zabbix) DBPassword=zabbix@findsec123(数据库密码) 附 (1)启动zabbix-server服务 systemctl start zabbix-server (2)查看zabbix-server状态 systemctl status zabbix-server (3)查看日志 cat /var/log/zabbix/zabbix_server.log

六、配置Zabbix 前端 vi /etc/php.ini max_execution_time = 300(每个脚本的最长执行时间) memory_limit = 128M(脚本占用的最大内存) post_max_size = 16M(php将接受的post数据的最大值) upload_max_filesize = 2M(上传文件最大值) max_input_time = 300(每个脚本用于分析请求数据的最长时间) max_input_vars = 10000(可以接受多少get/post/cookie输入变量) always_populate_raw_post_data = -1([color=rgba(0, 0, 0, 0.87)]开启后就可以用 $HTTP_RAW_POST_DATA 接收post raw data) date.timezone = Asia/Shanghai(时区)

七、启动zabbix服务端和httpd服务 1、启动zabbix-server服务 systemctl start zabbix-server 附:开机自启动 chkconfig zabbix-server on 2、启动httpd服务 systemctl start httpd.service 附:开机启动 chkconfig httpd on 火狐等浏览器打开zabbix界面 http://192.168.1.5/zabbix

网页篇

1、浏览器打开 http://192.168.1.5/zabbix

2、欢迎 3、检查先决条件 4、配置数据库 5、zabbix服务器详细信息 6、安装摘要 至此完成zabbix4.0(网页篇)

客户端篇

1、安装zabbix-agent(zabbix客户端) yum install zabbix-agent 2、启动zabbix-agent systemctl start zabbix-agent.servicechkconfig zabbix-agent on附:(1)查看zabbix-agent配置文件 grep -Ev '^$|^#' /etc/zabbix/zabbix_agentd.conf (2)查看日志 cat /var/log/zabbix/zabbix_agentd.log (3)查看zabbix-agent状态 systemctl status zabbix-agent.service3、浏览器打开网页 http://192.168.1.5/zabbix

至此完成zabbix二进制安装(客户端篇)

结束语:完成zabbix4.0二进制安装(前端篇) zabbix4.0二进制安装(网页篇) zabbix4.0二进制安装(客户端篇) 至此,zabbix4.0二进制安装配置才算完成。