一、环境准备
1,关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
2,关闭selinux
setenforce 0
vim /etc/selinux/config
This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - No SELinux policy is loaded.
SELINUX=disabled
SELINUXTYPE= can take one of three values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted
3,获取zabbix下载源,可能需要查看一下路径
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
4,更新yum源
yum clean all
yum makecache
5,同步时间
yum install ntpdate -y
ntpdate -u ntp.aliyun.com
mv /etc/localtime {,.bak}
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
二、正式安装ZABBIX5.0服务端
1,安装zabbix应用
yum install -y zabbix-server-mysql.x86_64 zabbix-agent
2,安装多版本软件并存工具包scl(software connection)默认(/opt/rh)
yum -y install centos-release-scl
3,修改zabbix源(enable 前端源)
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
4,安装zabbix前端软件
yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl.noarch
5,安装数据库(mariadb)
yum -y install mariadb-server.x86_64
6,配置数据库(启动并且开机自己)
systemctl enable --now mariadb.service
7,数据库初始化
mysql_secure_installation
1-Enter current password for root (enter for none):输入当前数据库root密码
当前root密码是空直接回车
2-Set root password? [Y/n]是否设置root密码?
y
zstack@123
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
8,登录数据库
mysql -uroot -p
zstack@123
create database zabbix character set utf8 collate utf8_bin; #创建一个zabbix的数据库
create user zabbix@localhost identified by 'zstack@123'; #创建一个用户 名称为zabbix,本机登录,密码为zstack@123
grant all privileges on zabbix.* to zabbix@localhost; #授权给 zabbix@localhost 用户在zabbix库下所有表有全部的权限
flush privileges; #刷新授权表
exit
9,使用zabbix-mysql命令,导入数据库信息
zcat /usr/share/doc/zabbix-server-mysql-5.0.17/create.sql.gz | mysql -uzabbix -p zabbix
mysql -uzabbix -pzstack@123
show databases;
use zabbix
show tables;
10,修改zabbix server 配置文件.
vim /etc/zabbix/zabbix_server.conf
/DBP #搜索DBPassword= 并且修改成当前密码
11,修改zabbix的php配置文件
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
修改时区timezone为Asia/Shanghai,前面;去掉
12,启动zabbix相关服务
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
13,登录web页面进行初始化配置
http://192.168.13.128/zabbix
默认账号密码是Admin/zabbix
14,修改为中文,安装字体解决部分乱码问题
User settings →language→update
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
至此服务端配置完成