CentOS7 安装 Zabbix5.0

1、关闭SELINUX

# setenforce 0            #暂时关闭,重启失效

修改配置文件中的SELINUX=disabled和SELINUXTYPE=mls 参数          #永久生效

#vim /etc/selinux/config

2、 安装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

3、安装zabbix server 、zabbix agent

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

4、安装zabbix前端软件包

# yum -y install centos-release-scl

编辑配置文件,启动zabbix前端存储库

# vim /etc/yum.repos.d/zabbix.repo 

[zabbix-frontend]
...……
enabled=1
...……

安装用于连接mysql、apache

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

5、安装mysql数据库

# yum -y install mariadb-server

# systemctl start mariadb  # 启动服务
# systemctl enable mariadb  # 设置为开机自启动服务

6、首次安装需要进行数据库的配置

# mysql_secure_installation

……

Enter current password for root (enter for none): 输入密码;没密码直接回车
OK, successfully used password, moving on...
……

Set root password? [Y/n] y是否设置密码 y与回车都是都设密码n不设密码
New password: 密码
Re-enter new password:  确认密码
Password updated successfully!
Reloading privilege tables..
 ... Success!

……

Remove anonymous users? [Y/n]  是否删除匿名用户y与回车是删除
 ... Success!

……

Disallow root login remotely? [Y/n] n 是否禁用远程用户登录
 ... skipping.

……

Remove test database and access to it? [Y/n] n  是否删除测试库
 ... skipping.
……
Reload privilege tables now? [Y/n] y  以上设置是否要生效
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

 7、设置MariaDB字符集为utf-8

# vim /etc/my.cnf

在  [mysqld]  下面添加

init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

# vim /etc/my.cnf.d/client.cnf 

在  [client]  下面添加

default-character-set=utf8

# vim /etc/my.cnf.d/mysql-clients.cnf

在  [mysql]  下面添加

default-character-set=utf8

重启服务

# systemctl restart mariadb

8、开启防火墙端口

# firewall-cmd --zone=public --add-port=3306/tcp --permanent  # 开启3306端口

# firewall-cmd --reload #重新加载
# firewall-cmd --query-port=3306/tcp  # 查看3306端口是否开启 

9、创建zabbix数据库

# mysql -uroot -p
输入设置的密码
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';   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_server配置文件

# vim /etc/zabbix/zabbix_server.conf

DBPassword=新密码

 10、为Zabbix前端配置PHP的时区

编辑配置文件

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

php_value[date.timezone] = Asia/Shanghai

11、启动Zabbix server和agent进程,并设置开机启动

# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

12、打开web的首次进入页面进行设置

http://IP/zabbix/setup.php

设置完成后默认用户名:Admin 密码:zabbix

13、解决中文界面部分乱码问题

下载谷歌的支持中文编码的字体包更换字体软链

# yum -y install google-noto-sans-simplified-chinese-fonts.noarch

# rm /etc/alternatives/zabbix-web-font

# ln -s /usr/share/fonts/google-noto/NotoSansSC-Regular.otf  /etc/alternatives/zabbix-web-font

14、 完成安装

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值