一.配置环境

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. WPF/C#:如何实现拖拉元素

    前言 在Canvas中放置了一些元素,需要能够拖拉这些元素,在WPF Samples中的DragDropObjects项目中告诉了我们如何实现这种效果. 效果如下所示: 拖拉过程中的效果如下所示: 具 ...

  2. Linux内核的5个子系统

    --- title: Linux内核的5个子系统 EntryName: subsystems_in_linux_kernel date: 2020-10-10 03:07:07 categories: ...

  3. STM32 CubeMX 学习:000-搭建开发环境

    背景 了解了 STM32 标准库以后,为了紧跟发展的潮流,我们以 CubeMx为基础 开始进行 Hal(Hardware Abstract Layer, 硬件抽象层)库的学习. CubeMx 是一个 ...

  4. Vs生成后 自动压缩 删除多余xml

    setlocal enabledelayedexpansionset ProjectName=$(ProjectName)del /s /q /f "$(ProjectDir)bin\Deb ...

  5. 在C#中使用RabbitMQ做个简单的发送邮件小项目

    在C#中使用RabbitMQ做个简单的发送邮件小项目 前言 好久没有做项目了,这次做一个发送邮件的小项目.发邮件是一个比较耗时的操作,之前在我的个人博客里面回复评论和友链申请是会通过发送邮件来通知对方 ...

  6. tcp_tw_reuse、tcp_tw_recycle、tcp_fin_timeout参数介绍

    参数介绍 net.ipv4.tcp_tw_reuse = 1 表示开启重用.允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭: net.ipv4.tcp_tw_rec ...

  7. SpringBoot注解配置文件映射属性和实体类

    配置文件加载 方式一 Controller上面配置@PropertySource({"classpath:pay.properties"}) 添加属性@Value("wx ...

  8. Solo 独立开发者社区

    Solo 独立开发者社区是一个致力于帮助独立开发者发展的社区平台.平台上聚集了大量的独立开发者,他们在这个平台上分享着自己的开发经验.心得和技巧,同时也可以从其他人的分享中获得启发和帮助. 这个社区提 ...

  9. 【nvm、node、npm、nrm】安装配置教程(windows版)

    一.nvm 的安装与配置 1.nvm 下载与安装 nvm官方下载地址 (我这里使用当前最新版本 1.1.12) 2.验证 nvm 是否安装成功 # 查看 nvm 版本 nvm -v # 显示远程可安装 ...

  10. 华为matebook 14s笔记本,Chrome浏览器开启硬件加速,屏幕闪屏,黑框,页面屏幕卡死,解决办法

    解决办法使用了 https://zhuanlan.zhihu.com/p/644296061 这个连接下的最后一个折中办法解决! 一.现象 Chrome开启"硬件加速模式"后,在观 ...