centos7.2安装zabbix5.0

Centos部署zabbix5.0

准备环境

zabbix server 192.168.142.172
zabbix database 192.168.142.172
zabbix agent 192.168.142.173

zabbix server是zabbix的服务端,即zabbix agent收集到主机数据,反馈给zabbix server,而zabbix database是用来存储数据的,将各个主机的数据存储在数据库中,一般使用mysql数据库,在这里,将zabbix server和zabbix database放在一台机器上。

配置yum源

wget http://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y epel-release
yum clean all
yum makecache

关闭selinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

关闭防火墙

systemctl stop firewalld.service
systemctl disabled firewalld.service

配置zabbix的yum源

vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
enabled=1
gpgcheck=0

[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend/
enabled=1
gpgcheck=0

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/debuginfo/
enabled=0
gpgcheck=0

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/x86_64/
enabled=1
gpgcheck=0

安装zabbix

yum -y install zabbix-server-mysql zabbix-agent

安装centos扩展软件库

yum -y install centos-release-scl

安装数据库

yum -y install mariadb-server mariadb

启动数据库

systemctl start mariadb 
systemctl enable mariadb

初始化数据库

mysql_secure_installation

安装数据库初始化文件和nginx

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

创建数据库并授权

mysql -uroot -p
Enter password:

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> create user [email protected] identified by 'zabbix';
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected];

导入数据库文件

zcat /usr/share/doc/zabbix-server-mysql-5.0.3/create.sql.gz|mysql -uzabbix -pzabbix -h192.168.142.172 -Dzabbix

修改zabbix配置文件

vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.142.172
DBPassword=zabbix

配置php环境

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

php_value[date.timezone] = Asia/Shanghai

启动服务

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm.service

systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm.service

在浏览器输入http://IP/zabbix进行zabbix的初始化

猜你喜欢

转载自blog.csdn.net/professorman/article/details/108520711