一.配置环境

1.1 Linux环境说明

zabbix 安装要求 https://www.zabbix.com/documentation/4.0/zh/manual/installation/requirements
[root@localhost bw]# cat /etc/redhat-release 查看系统版本信息
CentOS Linux release 7.4.1708 (Core)
[root@localhost bw]# systemctl stop firewalld.service 关闭防火墙
[root@localhost bw]# systemctl disable firewalld.service 开机禁止启动防火墙 [root@localhost bw]# 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 #永久关闭selinux
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted [root@localhost bw]#setenforce 0 临时关闭
[root@localhost bw]#getenforce 结果为Disabled 为关闭 检查selinux是否关闭

1.2 搭建LAMP环境

Zabbix是建立在LAMP或者LNMP环境之上,在此为了方便就使用yum安装LAMP环境。

# 建立仓库
[root@localhost bw]#yum -y install epel-release
[root@localhost bw]#yum -y install createrepo --downloadonly --downloaddir=/home/bw/repo [root@localhost bw]# cd repo
[root@localhost repo]#yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash --downloadonly --downloaddir=/home/bw/repo
[root@localhost repo]# yum localinstall -y ./* 安装后检查应用版本
[root@localhost repo]# rpm -qa httpd php mariadb 安装后检查应用版本
httpd-2.4.6-89.el7.centos.x86_64
mariadb-5.5.60-1.el7_5.x86_64
php-5.4.16-46.el7.x86_64 # 编辑httpd
[root@localhost repo]# vim /etc/httpd/conf/httpd.conf
95 ServerName www.aihuidi.com:80 修改主机名,URL
164 DirectoryIndex index.html index.php 修改首页文件格式 # 编辑配置PHP,配置中国时区
[root@localhost repo]# vim /etc/php.ini
878 date.timezone = PRC # 启动mysqld
[root@localhost repo]# systemctl start mariadb 启动数据库
[root@localhost repo]# systemctl enable mariadb 加入开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@localhost repo]# systemctl status mariadb 查看运行状态
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-06-13 00:31:21 CST; 11s ago
Main PID: 2490 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─2490 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─2653 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/ma... Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: MySQL manual for more instructions.
Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: Please report any problems at http://mariadb.org/jira
Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: The latest information about MariaDB is available at http://mariadb.org/.
Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: You can find additional information about the MySQL part at:
Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: http://dev.mysql.com
Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: Consider joining MariaDB's strong and vibrant community:
Jun 13 00:31:19 node2 mariadb-prepare-db-dir[2412]: https://mariadb.org/get-involved/
Jun 13 00:31:19 node2 mysqld_safe[2490]: 190613 00:31:19 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jun 13 00:31:19 node2 mysqld_safe[2490]: 190613 00:31:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jun 13 00:31:21 node2 systemd[1]: Started MariaDB database server. [root@localhost repo]# netstat -lntup|grep mysqld 查看服务端口是否存在
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2653/mysqld
6370/mysqld # 初始化数据库,并设置root用户密码
[root@localhost repo]# mysqladmin -u root password 123456 设置数据库密码
[root@localhost repo]# mysql -uroot -p 登录数据库
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin; #创建zabbix数据库
Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; #刷新权限
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> select user,host from mysql.user;
+--------+-----------+
| user | host |
+--------+-----------+
| zabbix | % |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | node2 |
| root | node2 |
+--------+-----------+
7 rows in set (0.00 sec) MariaDB [(none)]> drop user ''@localhost; # 删除空用户
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> select user,host from mysql.user;
+--------+-----------+
| user | host |
+--------+-----------+
| zabbix | % |
| root | 127.0.0.1 |
| root | ::1 |
| root | localhost |
| | node2 |
| root | node2 |
+--------+-----------+
6 rows in set (0.00 sec) MariaDB [(none)]> quit;
Bye

二.安装zabbix

安装依赖包+组件

[root@localhost repo]# yum -y install net-snmp net-snmp-devel curl curl-devel libxml2 libxml2-devel libevent-devel.x86_64 javacc.noarch javacc-javadoc.noarch javacc-maven-plugin.noarch javacc* --downloadonly --downloaddir=/home/bw/repo
[root@localhost repo]# yum install php-bcmath php-mbstring -y --downloadonly --downloaddir=/home/bw/repo 安装php支持zabbix组件
[root@localhost repo]# rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm 安装zabbix yum源 ,本地下载,上传到虚拟机上
[root@localhost repo]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y --downloadonly --downloaddir=/home/bw/repo 安装zabbix组件 #报错的话添加yum源
cat <<EOF > /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/\$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-non-supported]
name=Zabbix Official Repository non-supported - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
EOF # 添加密钥
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 \
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX \
-o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

yum localinstall -y ./* # 本地安装

安装zabbix agent篇(centos7)

[root@localhost repo]# wget http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.9-3.el7.x86_64.rpm
[root@localhost repo]# yum localinstall -y ./*
[root@localhost repo]# hostname
xxxxx
[root@localhost repo]# firewall-cmd --state
not running
[root@localhost repo]# vi /etc/zabbix/zabbix_agentd.conf
Server=xx.xx.xx.xx #zabbix-server地址
ServerActive=xx.xx.xx.xx #zabbix-server地址
Hostname=agent1 #这台安装zabbix-agent的主机名,可以通过hostname命令查看主机名
[root@localhost repo]# systemctl start zabbix-agent.service
[root@localhost repo]]# systemctl enable zabbix-agent.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@localhost repo]# systemctl status zabbix-agent.service
[root@localhost repo]# cat /var/log/zabbix/zabbix_agentd.log
导入初始架构和数据,系统将提示您输入新创建的密码
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: #导入数据到数据库zabbix中(最后一个zabbix是数据库zabbix),且因为用户zabbix是%(任意主机),密码是用户zabbix登陆密码zabbix

配置zabbix-server

[root@localhost repo]# vim /etc/zabbix/zabbix_server.conf 配置数据库密码
38:LogFile=/var/log/zabbix/zabbix_server.log
49:LogFileSize=0
72:PidFile=/var/run/zabbix/zabbix_server.pid
82:SocketDir=/var/run/zabbix
100:DBName=zabbix
116:DBUser=zabbix
124:DBPassword=123456 把注释打开写zabbix库的密码
356:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
473:Timeout=4
516:AlertScriptsPath=/usr/lib/zabbix/alertscripts
527:ExternalScripts=/usr/lib/zabbix/externalscripts
563:LogSlowQueries=3000 [root@localhost repo]# vim /etc/httpd/conf.d/zabbix.conf 修改时区
php_value date.timezone Asia/Shanghai [root@localhost repo]# systemctl enable zabbix-server 启动zabbix服务并加入开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
[root@localhost repo]# systemctl start zabbix-server
[root@localhost repo]# systemctl start httpd 启动httpd服务并加入开机自启动
[root@localhost repo]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@localhost repo]#

google 浏览器访问 http://ip/zabbix即可

zabbix离线包下载

# 链接:https://pan.baidu.com/s/1texfmbV-Y97gbGDamL_Ggg# 提取码:hmir

下载离线包以后直接解压,然后切换到解压的目录下,
执行 yum localinstall -y ./* 即可完成安装,然后按照上面的步骤配置即可。

参考链接1:https://blog.csdn.net/weixin_43822878/article/details/91569016

参考链接2: https://blog.csdn.net/GongMeiyan/article/details/104079380

centos7.5离线安装zabbix4.0的更多相关文章

  1. Centos7一键编译安装zabbix-4.0.2

    ##只针对centos7的系统有效,centos6无效,mysql zabbix用户:zabbix,密码:zabbix;建议用全新的centos7服务器 软件版本: (nginx-1.14.2.php ...

  2. CentOS7.x编译安装zabbix4.0

    编译安装zabbix Zabbix简介 Zabbix 是一个企业级的分布式开源监控方案. Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件.Zabbix使用灵活的通知机制,允许用户 ...

  3. CentOS7.6离线安装Redis5.0.4

    安装gcc-c++: 检查是否存在gcc-c++:rpm -qa|grep gcc-c++ 如果不存在就下载Linux-GC-C++文件: 访问镜像网站:http://mirrors.aliyun.c ...

  4. centos7上安装zabbix4.0

    zabbix4.0已经推出有一段时间了,针对之前版本做了很多优化配置,易用性得到提高,特别lts(long team support)长技术支持版本,官方说提供5年的稳定技术支持,在商业化运用上,是比 ...

  5. Centos7安装Zabbix4.0步骤

    点击返回:自学Zabbix之路 点击返回:自学Zabbix4.0之路 点击返回:自学zabbix集锦 Centos7安装Zabbix4.0步骤 官方搭建zabbix4.0的环境要求: 1. 环境搭建L ...

  6. CentOS7离线安装MySQL8.0

    CentOS7离线安装MySQL8.0 卸载软件 rpm -e --nodeps 要卸载的软件包 root@jacky zookeeper]# rpm -e --nodeps java-1.6.0-o ...

  7. centos7.6下编译安装zabbix4.0.10长期支持版

    一.安装数据库,这里使用的是percona-server5..24版本 配置如下 [root@zabbix4_clone:~]# cat /etc/my.cnf # Example MySQL con ...

  8. centos7.2下快速安装zabbix4.0

    本笔记是基于CentOS 7.2下最小化安装的操作系统搭建的Zabbix4.0环境,主要用于做一些企业路由器和交换机等设备的运行状态监控. 1.安装epel源 yum -y install epel- ...

  9. 最强离线安装MySQL_8.0.2方法

    最强离线安装MySQL_8.0.2方法,一次就能安装成功. 按照此方式,离线安装MySQL五分钟都花不到,节省了大量的宝贵时间. 前戏,假设你已经从MySQL官网中获取了下面这个压缩包: 解压之后变成 ...

  10. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

随机推荐

  1. STM32 CubeMX 学习:05-串口

    --- title: mcu-stm32-cube-05-using-serial.md date: 2020-03-09 10:37:34 categories: tags: - stm32 - c ...

  2. 嵌入式ARM端测试手册——全志T3+Logos FPGA评估板(下)

    前 言 本指导文档适用开发环境: Windows开发环境:Windows 7 64bit.Windows 10 64bit Linux开发环境:Ubuntu18.04.4 64bit 虚拟机:VMwa ...

  3. Java中的泛型(类、接口、方法)

    一.泛型概述 1. 什么是泛型? 泛型,即"参数化类型".一提到参数,最熟悉的就是定义方法时有形参列表,普通方法的形参列表中,每个形参的数据类型是确定的,而变量是一个参数.在调用普 ...

  4. Mac 完整卸载mysql

    依次执行 cd ~ sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/M ...

  5. Java-JSTL标签简化和替换jsp页面上的java代码

    概念:JavaServer Pages Tag Library JSP标准标签库 作用:用于简化和替换jsp页面上的java代码 使用标签: 导入jstl相关jar包 引入标签库:taglib指令:& ...

  6. [oeasy]python00134_[趣味拓展]python起源_历史_Guido人生_ABC编程语言_Tanenbaum

    python 历史 回忆上次内容 颜文字是kaomoji 把字符变成一种图画的方法 一层叠一层 很多好玩儿的kaomoji是一层层堆叠起来的meme   ​   添加图片注释,不超过 140 字(可选 ...

  7. 第二章 编译FFmpeg并开启H.264编码

    目录 前言 1. 下载x264 2. 编译x264 3. 编译FFmpeg 3.1 可能出现的问题和解决方法 3.1.1 ERROR: x264 not found using pkg-config ...

  8. 题解:AT_abc359_c [ABC359C] Tile Distance 2

    背景 去中考了,比赛没打,来补一下题. 分析 这道题让我想起了这道题(连题目名称都是连着的),不过显然要简单一些. 这道题显然要推一些式子.我们发现,和上面提到的那道题目一样,沿着对角线走台阶,纵坐标 ...

  9. 使用 useNuxtData 进行高效的数据获取与管理

    title: 使用 useNuxtData 进行高效的数据获取与管理 date: 2024/7/22 updated: 2024/7/22 author: cmdragon excerpt: 深入讲解 ...

  10. js 做树形数组查询筛选功能

    对二级菜单进行搜索查询: watch: { librarySearch(val) { if(val == '') { this.libraryFiles = this.libraryFilesAll ...