Zabbix Server 5 一键安装脚本

Zabbix一键安装脚本

Zabbix一键安装脚本长期维护,支持高度定制化,且交互式进行,支持多技术栈的多版本选择,可根据需要安装Nginx/PHP/MySQL/MariaDB/Zabbix/Adminer/phpMyAdmin/Grafana,适用于CentOS 7〜8,架构为 x86_64 bit 的系统。

安装方式:Nginx/Zabbix编译安装、MySQL/MariaDB二进制安装、Grafana rpm安装,所有安装包均来自于软件官方。另外,由于软件官方大多属于国外源下载较慢,下载期间请确保SSH终端连接状态。

脚本属性

  • 支持Nginx-1.21、Grafana-7.4;
  • 支持Zabbix Server/Agent选择性安装;
  • 支持多个数据库版本(MySQL-8,MariaDB-10.5);
  • 支持多个PHP版本(PHP-7.4,PHP-8.0);
  • 支持多个数据库管理工具(Adminer-4,phpMyAdmin-5);

最新版本(2022-04-18)

使用 SSH 连接工具连接到您的 Linux 服务器后,拷贝并执行如下命令开始安装:

curl -O https://renwole.com/sh/install_zabbix_v0.9.2.sh && bash install_zabbix_v0.9.2.sh

安装过程说明:https://renwole.com/ilnmp/install-zabbix

Zabbix安装后的相关信息:

  • Zabbix UI入口:http://IP/ui
  • Zabbix管理平台账号密码:Admin/zabbix
  • Zabbix数据库/账号/密码:zabbix/zabbix/zabbix

Grafana安装后的相关信息:

  • Grafana使用rpm安装
  • Grafana UI入口:http://IP:3000
  • Grafana UI登陆账号/密码:admin/admin

脚本支持模块

模块名描述
enable-server启用Zabbix Server
enable-agent启用Zabbix agent
enable-proxy启用Zabbix proxy可代理采集数据,从而分担单个 Zabbix server 的负载
enable-ipv6启用对IPV6协议的支持
enable-java启用Zabbix Java gateway以支持监控 JMX 应用程序
with-mysql启用MySQL做为后端存储数据库
with-iconv启用转码,例如GBK转UTF-8,防止乱码
with-libcurl启用Web监控、VMware监控以及SMTP(邮件发送)需要的组件
with-libxml2启用VMware监控所需组件
with-ssh2SSH检查是作为无代理程序监视执行的。SSH检查不需要Zabbix Agent
with-openipmi启用IPMI协议监控服务器温度、风扇转速等
with-net-snmp启用SNMP协议监控打印机、路由器、UPS等设备
以上模块在编译安装zabbix中已自动添加开启。

应用安装目录

软件名路径说明
Nginx/PHP/MySQL/Zabbix/apps/server所有ILNMP应用安装及数据存储目录
Zabbix ConfigFile/apps/server/zabbix/etcZabbix Server监控安装目录
Grafanarpm安装方式路径系统默认配置文件在/etc/下

更新日志及历史版本查看下载

Zabbix Server 5 一键安装脚本》有90个想法

  1. 墨涩

    博主你好,下一个版本是不是只能在容器中搭建,能不能增加系统直接安装的一键版本,容器技术确实好,但是还不太会用。

    回复
  2. 农民工

    HTTP request sent, awaiting response… 404 Not Found
    2022-05-15 21:08:54 ERROR 404: Not Found.

    Auto download failed! You can manually download http://mirrors.sohu.com/nginx/nginx-1.21.6.tar.gz into the /opt directory.
    Killed
    [root@localhost ~]# tar (child): nginx-1.21.6.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    install_zabbix_v0.9.2.sh: line 168: cd: nginx-1.21.6: No such file or directory
    sed: can’t read auto/cc/gcc: No such file or directory
    install_zabbix_v0.9.2.sh: line 171: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    ERROR: Nginx install failed, Please Contact the author!

    资源库404.。。

    回复
  3. Michael

    老哥,现在数据库的下载站已经没有8.0.25版本的了 跑脚本的时候会直接报错找不到这个,改为8.0.26版本即可正常运行

    回复
  4. zabbix

    –2022-01-25 11:09:12– http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz
    Resolving mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)… 202.141.176.110
    Connecting to mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.176.110|:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    2022-01-25 11:09:12 ERROR 404: Not Found.

    Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz into the /opt directory

    回复
  5. 245837

    install_zabbix_v0.9.1.sh:行126: wget: 未找到命令
    已杀死
    Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz into the /opt directory.
    [root@localhost ~]# tar (child): mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz:无法 open: 没有那个文件或目录
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    mv: 无法获取”mysql-8.0.25-linux-glibc2.12-x86_64/*” 的文件状态(stat): 没有那个文件或目录
    ERROR: MySQL install failed, Please contact the author!
    ^C

    回复
    1. 245837

      make: *** 没有规则可以创建“default”需要的目标“build”。 停止。
      ERROR: Nginx install failed, Please Contact the author!
      –2022-01-04 14:16:16– http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz
      正在解析主机 mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)… 202.141.160.110
      正在连接 mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.160.110|:80… 已连接。
      已发出 HTTP 请求,正在等待回应… 404 Not Found
      2022-01-04 14:16:16 错误 404:Not Found。

      Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz into the /opt directory.
      已杀死
      [root@localhost ~]# tar (child): mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz:无法 open: 没有那个文件或目录
      tar (child): Error is not recoverable: exiting now
      tar: Child returned status 2
      tar: Error is not recoverable: exiting now
      mv: 无法获取”mysql-8.0.25-linux-glibc2.12-x86_64/*” 的文件状态(stat): 没有那个文件或目录
      ERROR: MySQL install failed, Please contact the author!

      回复
  6. moon

    2021-11-15 17:26:38 ERROR 404: Not Found.

    Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz into the /opt directory.
    Killed
    [root@iZuf65saybbvaw5kjlol48Z admin]# tar (child): mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    mv: cannot stat ‘mysql-8.0.25-linux-glibc2.12-x86_64/*’: No such file or directory
    ERROR: MySQL install failed, Please contact the author!

    回复
  7. cc

    站长好,有离线安装包吗?

    因为安装环境在内网,没有办法在线yum 以及加其他源,所以需要把安装文件都copy到服务器上。

    非常感谢。

    回复
    1. 大奶茶

      http://mirrors.ustc.edu.cn/mariadb/mariadb-10.5.10/bintar-linux-systemd-x86_64/mariadb-10.5.10-linux-systemd-x86_64.tar.gz
      Resolving mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)… 202.141.160.110
      Connecting to mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.160.110|:80… connected.
      HTTP request sent, awaiting response… 404 Not Found
      2022-01-05 10:40:56 ERROR 404: Not Found.

      Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mariadb/mariadb-10.5.10/bintar-linux-systemd-x86_64/mariadb-10.5.10-linux-systemd-x86_64.tar.gz into the /opt directory.
      Killed
      [root@localhost ~]# tar (child): mariadb-10.5.10-linux-systemd-x86_64.tar.gz: Cannot open: No such file or directory
      tar (child): Error is not recoverable: exiting now
      tar: Child returned status 2
      tar: Error is not recoverable: exiting now
      mv: cannot stat ‘mariadb-10.5.10-linux-systemd-x86_64/*’: No such file or directory
      ERROR: MariaDB install failed, Please contact the author!
      2022-01-05 10:29:29 ERROR 404: Not Found.

      Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz into the /opt directory.
      Killed
      [root@localhost ~]# tar (child): mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz: Cannot open: No such file or directory
      tar (child): Error is not recoverable: exiting now
      tar: Child returned status 2
      tar: Error is not recoverable: exiting now
      mv: cannot stat ‘mysql-8.0.25-linux-glibc2.12-x86_64/*’: No such file or directory
      ERROR: MySQL install failed, Please contact the author!

      数据库安装的路径全部都失效了

      回复
  8. caibaozi

    中文版显示有乱码,按照百度教程添加了字体还是显示乱码。不知作者大大有没有好的解决办法

    回复
  9. 小年糕

    gzip: stdin: unexpected end of file
    tar: 归档文件中异常的 EOF
    tar: 归档文件中异常的 EOF
    tar: Error is not recoverable: exiting now
    install_zabbix_v0.9.1.sh:行802: ./configure: 没有那个文件或目录
    make: *** 没有规则可以创建目标“install”。 停止。
    Zabbix install Failed, Please Contact the author
    Nginx Start [OK]
    MariaDB is not installed
    MySQL Start [OK]
    PHP Start [OK]
    Zabbix Server is not installed
    Zabbix Agent is not installed
    Grafana Start [OK]

    每次安装时总是Zabbix安装不成功

    回复
    1. moon

      Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz into the /opt directory.
      已杀死
      [root@zz ~]# tar (child): mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz:无法 open: 没有那个文件或目录
      tar (child): Error is not recoverable: exiting now
      tar: Child returned status 2
      tar: Error is not recoverable: exiting now
      mv: 无法获取’mysql-8.0.25-linux-glibc2.12-x86_64/*’ 的文件状态(stat): 没有那个文件或目录
      ERROR: MySQL install failed, Please contact the author!

      出错了大佬,帮忙看看、

      回复
  10. 部署用不了了吗

    make: *** 没有规则可以创建“default”需要的目标“build”。 停止。
    ERROR: Nginx install failed, Please Contact the author!
    –2021-05-19 16:58:27– http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.22-linux-glibc2.12-x86_64.tar.xz
    正在解析主机 mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)… 202.141.160.110
    正在连接 mirrors.ustc.edu.cn (mirrors.ustc.edu.cn)|202.141.160.110|:80… 已连接。
    已发出 HTTP 请求,正在等待回应… 404 Not Found
    2021-05-19 16:58:27 错误 404:Not Found。

    Auto download failed! You can manually download http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-8.0.22-linux-glibc2.12-x86_64.tar.xz into the /opt directory.
    已杀死
    tar (child): mysql-8.0.22-linux-glibc2.12-x86_64.tar.xz:无法 open: 没有那个文件或目录
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    [root@localhost ~]# mv: 无法获取”mysql-8.0.22-linux-glibc2.12-x86_64/*” 的文件状态(stat): 没有那个文件或目录
    ERROR: MySQL install failed, Please contact the author!

    回复
      1. andy

        安装zabbix server 5.2 创建监控项,监控端口;
        无法配置端口监控,显示的界面和官方文档不一致,不知道你们有没有遇到

        回复
  11. dotpy

    谢谢博主这么好的脚本。两个问题想咨询下呀
    1、zabbix server和zabbix agent可不可以同时安装呀,我先安装完zabbix server ,完成zabbix初始化登录到界面以后,再执行脚本安装zabbix agent,安装完成以后,总是报错:
    ent checks on host “Zabbix server”: host unavailable

    2、登录页面的URL一定要是http://IP/ui,可以修改吗?不想要后面的UI

    回复
    1. Node 文章作者

      1.主机名不存在,可在zabbix agent配置文件中修改成当前主机的主机名即可,修改成功后记得重启Agent服务才会生效;
      2.登录URL可以自定义的,只需要将UI目录下的所有文件移动到上一层目录,然后使用IP可直接访问。

      回复
      1. dotpy

        谢谢博主答复,已经解决了!这么好的脚本发给红包打赏下也不为过呀。
        是否可以加个微信交流下呀,有性能优化方面的问题想请教下呀!

        回复
  12. zhangguoqiang

    .
    Nginx Start [OK]
    MariaDB is not installed
    MySQL Start [OK]
    PHP is not installed
    Zabbix Server is not installed
    Zabbix Agent is not installed
    Grafana Start [OK]
    ===========================================
    Thank you for using Renwole.com script
    ===========================================
    RootUser: root
    RootPasswd: I#p1%sX@Renwole
    ===========================================
    PHPInfo: http://IP/php.php
    phpMyAdmin: http://IP/phpmyadmin
    ===========================================
    Grafana WebUI: http://IP:3000
    Grafana User/Passwd: admin/admin

    回复
    1. Node 文章作者

      这边会调研下,若可以,将会在下个版本支持更多服务,包含前期的一些同学提出的需求。

      回复
  13. Jaxson Wang

    CentOs 7 安装失败了 报错信息:

    install_zabbix.sh: line 94: ulimit: open files: cannot modify limit: Operation not permitted
    sed: can’t read auto/cc/gcc: No such file or directory
    install_zabbix.sh: line 96: ./configure: No such file or directory
    make: *** No targets specified and no makefile found. Stop.
    ERROR: Nginx install failed, Please Contact the author!

    回复
  14. 折子戏

    在安装libzip的时候,需要添加一下环境变量
    export PKG_CONFIG_PATH=”/usr/local/lib/pkgconfig/”
    有的电脑需要

    yum install gd gd-devel

    回复
  15. 周军军

    数据库选择mariadb在自己PC上安装没问题,但是在虚拟机上安装时候出现ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2),zabbixWeb打开存在报错mysqli::real_connect(): (HY000/2002): No such file or directory [setup.php:99 → CSetupWizard->__construct() → CSetupWizard->eventHandler() → CSetupWizard->dbConnect() → DBconnect() → MysqlDbBackend->connect() → mysqli->real_connect() in include/classes/db/MysqlDbBackend.php:169]
    No such file or directory,请问是什么问题导致,或者修改什么参数可以解决

    回复
    1. Node 文章作者

      需要确认几点:
      MySQL是否安装成功;
      是什么版本的linux发行版;
      通常这种情况,可以考虑将配置文件中的“localhost” 变更成 “127.0.0.1” 可尝试。

      回复

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code