zabbix服务器初始化(实验环境):
1)修改主机名,关闭防火墙,关selinux
2)配置yum源
清空默认源:
cd /etc/yum.repos.d
rm -rf *
# 下载对应版本的zabbix仓库
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
新建一个centos7.repo
vi centos7.repo
[base]
name=base
baseurl=https://repo.huaweicloud.com/centos/7/os/x86_64/
enable=1
gpgcheck=0
[extras]
name=extrax
baseurl=https://repo.huaweicloud.com/centos/7/extras/x86_64/
enable=1
gpgcheck=0
[updates]
name=updates
baseurl=https://repo.huaweicloud.com/centos/7/updates/x86_64/
enable=1
gpgcheck=0
#清除缓存,新建缓存
yum clean all
yum makecache
#安装Zabbix server,Web前端,agent
yum install -y zabbix-server-mysql zabbix-agent
#安装红帽软件集合
yum install -y centos-release-scl
#编辑配置文件
vi /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
#安装zabbix前端软件包
yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl
-------------------------------------------------------------------------------
安装数据库(mariadb)
1. yum install mariadb-server mariadb -y
2.启动数据库,初始化并加入开机自启
systemctl start mariadb && systemctl enable mariadb
mysql_secure_installation(过程略)
3.配置数据库
mysql -uroot -p
1)创建zabbix数据库
create database zabbix character set utf8 collate utf8_bin;
2)为数据库用户登录赋权,及其他相关设置
create user zabbix@localhost identified by '123456';
grant all privileges on zabbix.* to zabbix@localhost;
set global log_bin_trust_function_creators = 1;
quit
4.导入初始架构(注意:以下*号需要替换成zabbix具体版本号,比如zabbix-server-mysql-5.0.42)
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
导入数据库架构后禁用log_bin_trust_function_creators选项
mysql -u root -p
set global log_bin_trust_function_creators = 0;
quit
5. zabbix配置文件设置
1)数据库密码:
vi /etc/zabbix/zabbix_server.conf
.....#开启124行
DBPassword=123456
2)时区
vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
#开启25行
php_value[date.timezone] = Asia/Shanghai
6.重启相关服务,并加入开机自启
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
-------------------------------------------------------------------
测试访问:http://zabbix服务器地址/zabbix
初始密码:Admin/zabbix
设置中文:
user settings - >Chinese