centos7 基于LAMP安装zabbix5.0
参考文档:
https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=apache
https://www.cnblogs.com/ccku/p/13418348.html
一. 基本环境配置
1.关闭selinux
setenforce 0 #临时关闭
sed -i s#'SELINUX=enforcing'#'SELINUX=disabled'#g /etc/selinux/config #永久关闭,重启生效
2.关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
3.LAMP环境
安装apache
yum install httpd -y
systemctl enable httpd
systemctl start httpd
安装mariadb
yum install -y mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
安装php
yum install -y php php-mysql
二.zabbix安装
下载zabbix包
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
安装zabbixserver和agent
yum install zabbix-server-mysql zabbix-agent -y
安装前端
yum install centos-release-scl -y
编辑配置文件
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
安装前端包
# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
三。初始化数据库
进入数据库
mysql -uroot -p #mariadb默认密码为空,直接回车
password
mysql> create database zabbix character set utf8 collate utf8_bin;#创建zabbix数据库
mysql> create user zabbix@localhost identified by 'zabbix';#创建zabbix用户,密码为zabbix
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
导入架构数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
#输入zabbix用户密码
zabbix server配置数据库
vim /etc/zabbix/zabbix_server.conf
91行“DBHost=localhost”取消注释
或者改为DBHost=127.0.0.1
125行“DBPassword=zabbix”
zabbix前端配置php
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
; php_value[date.timezone] = Europe/Riga
php_value[date.timezone] = Asia/Shanghai
启动并设置开机自启
# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
访问: http://server_ip or name/zabbix