https://www.zabbix.com/cn/download?zabbix=4.4&os_distribution=centos&os_version=7&db=mysql&ws=apache
服务端
1.准备工作
测试环境:
关闭SElinux、防火墙
centos7.6
关闭SELinux与防火墙
#1.关闭SElinuxsetenforce 0vim /etc/selinux/configSELINUX=disabled#2.关闭防火墙systemctl stop firewalldsystemctl disable firewalld
安装httpd
#1.安装yum install -y httpd#2.开机自启systemctl enable httpd#3.启动systemctl start httpd
安装Mariadb
#1.安装yum install -y mariadb mariadb-server#2.设置自启动systemctl enable mariadb#3.启动systemctl start mariadb#4.数据库安全初始化mysql_secure_installation#5.连接数据库后创建zabbix所需的数据库与系统用户MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
2.安装Zabbix
添加Zabbix软件仓库
#1.安装软件仓库rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm#2.修改软件仓库配置vim /etc/yum.repo.d/zabbix.repo[zabbix]name=Zabbix Official Repository - $basearchbaseurl=https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/...
安装Zabbix服务端和前端
yum install zabbix-server-mysql zabbix-web-mysql
导入数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix#连接mysql查看是否导入成功MariaDB [(none)]> use zabbixMariaDB [(none)]> show tables;
3.配置Zabbix
#1.修改与zabbix与数据库连接配置vim /etc/zabbix/zabbix_server.confDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbix#2.修改前端的时区配置vim /etc/httpd/conf.d/zabbix.confphp_value max_execution_time 300php_value memory_limit 128Mphp_value post_max_size 16Mphp_value upload_max_filesize 2Mphp_value max_input_time 300php_value always_populate_raw_post_data -1# php_value date.timezone Asia/Shanghai
4.启动
#加入自启systemctl enbale zabbix-server#启动systemctl start zabbix-server
访问本机IP完成初始化
客户端
#1.获取客户端wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.18-1.el7.x86_64.rpm#2.安装rpm -ivh zabbix-agent-4.0.18-1.el7.x86_64.rpm#3.配置客户端cat /etc/zabbix/zabbix_agentd.confPidFile=/var/run/zabbix/zabbix_agentd.pidLogFile=/var/log/zabbix/zabbix_agentd.logLogFileSize=0Server=127.0.0.1 #服务端的IP地址ServerActive=127.0.0.1Hostname=Zabbix serverInclude=/etc/zabbix/zabbix_agentd.d/*.conf#4.开启自启systemctl enable zabbix-agentd#5.启动systemctl start zabbix-agentd
