前置操做
一、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
二、关闭selinx
setenforce 0
附:查看selinux的命令及永久关闭selinux
getenforce
vi /etc/sysconfig/selinux
SELINUX=enforcing 改成 SELINUX=disabled
三、添加域名解析
在/etc/hosts当中添加一条记录(主机ip地址加域名)
192.168.1.5 zabbix.serverphp
1、基础配置
一、使用某里巴巴的镜像源来加速操做系统的软件包安装
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
二、安装epel-release源(包含了基础镜像不包含的工具包)
yum groups install epel-release
三、安装经常使用开发组件development tool
yum groups install "Development Tools"
附:查看Development Tool 包含的工具包命令(yum groups info “Development Tools")
四、添加zabbix的镜像源
rpm -ivh https://repo.zabbix.com/zabbix/4 ... .0-1.el7.noarch.rpm
五、重启
reboot前端
2、安装zabbix-server及相关rpm包
一、安装zabbix-server-mysql(服务端)
yum install zabbix-server-mysql
二、安装zabbix-web-mysql(前端)
yum install zabbix-web-mysql
三、安装mariadb-server(数据库服务)
yum install mariadb-servermysql
3、初始化mariadb-server
一、启动mariadb
systemctl start mariadb
附:查看mariadb的状态、进程、自启动
systemctl status mariadb
ps aux | grep mysqlchkconfig mariadb on二、初始化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]是否从新加载权限:ylinux
4、建立数据库zabbix
一、进入数据库
mysql -uroot -p
Enter password: 回车键
二、建立数据库zabbix,字符集为utf8
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
附:显示数据库zabbix
MariaDB [(none)]>show databases;
三、授予用户localhost密码findsec123在数据库zabbix上全部权限
MariaDB [(none)]>grant all privileges on zabbix. to zabbix@localhost identified by 'zabbix@findsec123';
四、更新权限表
MariaDB [(none)]> flush privileges;
五、退出数据库
MariaDB [(none)]> quit;
六、导入数据结构
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;web
5、修改zabbix-server的配置文件
vi /etc/zabbix/zabbix_server.confbr/>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.logsql
6、配置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(时区)数据库
7、启动zabbix服务端和httpd服务
一、启动zabbix-server服务
systemctl start zabbix-server
附:开机自启动
chkconfig zabbix-server on
二、启动httpd服务
systemctl start httpd.service
附:开机启动
chkconfig httpd on
火狐等浏览器打开zabbix界面
http://192.168.1.5/zabbix浏览器
一、浏览器打开
http://192.168.1.5/zabbix服务器
二、欢迎
三、检查先决条件
四、配置数据库
五、zabbix服务器详细信息
六、安装摘要
至此完成zabbix4.0(网页篇)cookie
一、安装zabbix-agent(zabbix客户端)
yum install zabbix-agent
二、启动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.service三、浏览器打开网页
http://192.168.1.5/zabbix
至此完成zabbix二进制安装(客户端篇)
结束语:完成zabbix4.0二进制安装(前端篇)zabbix4.0二进制安装(网页篇)zabbix4.0二进制安装(客户端篇)至此,zabbix4.0二进制安装配置才算完成。