最近zabbix官方发布了5.x版本,但是下载说明比较简陋,按照官方的命令可能会有2,3个坑,这边文章主要介绍这两三个坑和解决办法。
准备工作:
1.关闭selinux,关闭firewalld.service服务或者添加允许条目,安装zabbix的官方源:
# sestatus 查看当前selinux状态 SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from con【我.爱.线.报.网.】fig file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31 # vi /etc/selinux/config … SELINUX=disabled 修改SELINUX值为disabled … # sestatus 查验修改后的selinux状态 SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux ro【我.爱.线.报.网.】ot directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: disabled Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 31 # systemctl disable firewalld.service 禁用firewalld.service的开机启用 Remove【我.爱.线.报.网.】d /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. # systemctl stop firewalld.service 停止当前firewalld.service # rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm Retrieving https:/【我.爱.线.报.网.】/repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm warning: /var/tmp/rpm-tmp.rtS41M: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Verifying… ################################# [100%] Preparing… ################################# [100%] Updating / installing… 1:zabbix-releas【我.爱.线.报.网.】e-5.0-1.el8 ################################# [100%]2.配置mariadb:
# dnf install mariadb-server nginx -y 安装mariadb和nginx # systemctl enable mariadb nginx 加入开机自启动 # systemctl start mariadb nginx 启动mariadb和nginx # mysql_secure_installation 根据提示完成数据库初始化设置 # mysql -uroot -p 进入数据库创建zabbix数据库并赋权zabbix用户 >create database 【我.爱.线.报.网.】zabbix characterset utf8 collate utf8_bin; 编码务必选择utf8,否则zabbix数据库导入过程会出错 > grant all on zabbix.* to zabbix@localhost identified by zabbix_password; > exit;3.安装配置zabbix相关:
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz【我.爱.线.报.网.】 | mysql -uzabbix -p zabbix # vi /etc/zabbix/zabbix_server.conf 修改数据库相关的配置 DBHost=localhost DBUser=zabbix DBPassword=zabbix@mariadb # vi /etc/nginx/conf.d/zabbix.conf listen 8000; 重点关注此端口,nginx安装完后默认建立一个端口为80的站点,不修改此端口号,打开zabbix会出现404错误 #vi /etc/php-fpm.d/zabbix.conf php_value[date.timezone] = Asia/Shanghai 把时区改【我.爱.线.报.网.】为当前时区,注意删除最前面的; # systemctl start zabbix-server zabbix-agent nginx php-fpm # systemctl restart zabbix-server zabbix-agent nginx php-fpm # systemctl enable zabbix-server zabbix-agent nginx php-fpm至此安装完毕,打开http:ip:8000即可开始zabbix安装向导。
注:安装过程中错误及解决办法:
1.不能下载zabbix安装包
网络问题 设置网络代理即可
2.zabbix数据库导入数据库时出错
数据库编码问题 cr【我.爱.线.报.网.】eate database zabbix character set utf8 collate utf8_bin;
3.提示网络权限问题
vi /etc/selinux/config
selinux=disabled;
setenforce 0
systemctl disable firewalld.service
systemctl stop firewalld.service
4.安装完毕,打开zabbix404问题,
vi /etc/php-fpm.d/zabbix.conf
修改默认80端口即可。原因 nginx自动创建一个80端口网站与zabbix冲突。
推荐阅读
友情提醒: 请尽量登录购买,防止付款了不发货!
QQ交流群:226333560 站长微信:qgzmt2