搭建Zabbix服务(Linux系统)

环境: centos7、lamp、防火墙关闭、selinux关闭

配置阿里云zabbix yum源

[root@chenshuyi ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
获取https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:zabbix-release-3.4-1.el7.centos  ################################# [100%]

清理缓存

[root@chenshuyi ~]# yum clean all
已加载插件:fastestmirror
正在清理软件源: base zabbix zabbix-non-supported
Cleaning up list of fastest mirrors
Other repos take up 52 M of disk space (use --verbose for details)
[root@chenshuyi ~]# yum makecache
已加载插件:fastestmirror[h2title][/h2title]
Determining fastest mirrors
base                                                         | 3.6 kB  00:00:00
zabbix                                                       | 2.9 kB  00:00:00
zabbix-non-supported                                         | 2.9 kB  00:00:00
(1/10): base/group_gz                                        | 153 kB  00:00:00
(2/10): base/filelists_db                                    | 3.3 MB  00:00:00
(3/10): base/primary_db                                      | 3.3 MB  00:00:00
(4/10): base/other_db                                        | 1.3 MB  00:00:00
(5/10): zabbix/x86_64/filelists_db                           |  87 kB  00:00:00
(6/10): zabbix/x86_64/primary_db                             | 118 kB  00:00:01
(7/10): zabbix-non-supported/x86_64/filelists_db             | 1.8 kB  00:00:00
(8/10): zabbix-non-supported/x86_64/primary_db               | 3.7 kB  00:00:00
(9/10): zabbix/x86_64/other_db                               | 102 kB  00:00:00
(10/10): zabbix-non-supported/x86_64/other_db                | 3.3 kB  00:00:00
元数据缓存已建立
[root@chenshuyi ~]#

安装相关的配置

[root@chenshuyi yum.repos.d]# yum install zabbix-server-mysql zabbix-agent zabbix-web-mysql -y
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
软件包 zabbix-server-mysql-3.4.15-1.el7.x86_64 已安装并且是最新版本
软件包 zabbix-agent-3.4.15-1.el7.x86_64 已安装并且是最新版本
软件包 zabbix-web-mysql-3.4.15-1.el7.noarch 已安装并且是最新版本
无须任何处理

更改/etc/php.ini文件的时区配置

384 max_execution_time = 300
394 max_input_time = 300
672 post_max_size = 16M
878 date.timezone = UTC

创建zabbix数据库并授权用户

MariaDB [(none)]> grant all
    -> privileges on *.*
    -> to zabbix@localhost
    -> identified by '123';
Query OK, 0 rows affected (0.00 sec)

解压zabbix的数据脚本

[root@chenshuyi yum.repos.d]# cd /usr/share/doc/zabbix-server-mysql-3.4.15/
[root@chenshuyi zabbix-server-mysql-3.4.15]# ll
总用量 2120
-rw-r--r--. 1 root root      98 1112 2018 AUTHORS
-rw-r--r--. 1 root root  866545 1112 2018 ChangeLog
-rw-r--r--. 1 root root   17990 1112 2018 COPYING
-rw-r--r--. 1 root root 1267039 1112 2018 create.sql.gz
-rw-r--r--. 1 root root      52 1112 2018 NEWS
-rw-r--r--. 1 root root    1062 1112 2018 README
[root@chenshuyi zabbix-server-mysql-3.4.15]# gunzip create.sql.gz
[root@chenshuyi zabbix-server-mysql-3.4.15]# ll
总用量 5756
-rw-r--r--. 1 root root      98 1112 2018 AUTHORS
-rw-r--r--. 1 root root  866545 1112 2018 ChangeLog
-rw-r--r--. 1 root root   17990 1112 2018 COPYING
-rw-r--r--. 1 root root 4990625 1112 2018 create.sql
-rw-r--r--. 1 root root      52 1112 2018 NEWS
-rw-r--r--. 1 root root    1062 1112 2018 README

登录数据库,读入zabbix数据,生成zabbix数据库

MariaDB [(none)]> use zabbixdb
Database changed
MariaDB [zabbixdb]> source /usr/share/doc/zabbix-server-mysql-3.4.15/create.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

Query OK, 0 rows affected (0.00 sec)

配置zabbix文件

100 DBName=zabbixdb
 #数据库名字
116 DBUser=zabbix
 #用户名
124 DBPassword=123
 #数据库密码
139 DBPort=3306
 #数据库端口

启动服务

[root@chenshuyi zabbix-server-mysql-3.4.15]# systemctl restart httpd
[root@chenshuyi zabbix-server-mysql-3.4.15]# systemctl start zabbix-server

查端口

[root@chenshuyi zabbix-server-mysql-3.4.15]# ss -lunt
Netid State      Recv-Q Send-Q                                             Local Address:Port                                                            Peer Address:Port
udp   UNCONN     0      0                                                      127.0.0.1:323                                                                        *:*
udp   UNCONN     0      0                                                          [::1]:323                                                                     [::]:*
tcp   LISTEN     0      128                                                            *:22                                                                         *:*
tcp   LISTEN     0      128                                                            *:10051                                                                      *:*
tcp   LISTEN     0      50                                                             *:3306                                                                       *:*
tcp   LISTEN     0      128                                                         [::]:80                                                                      [::]:*
tcp   LISTEN     0      128                                                         [::]:22                                                                      [::]:*
tcp   LISTEN     0      128                                                         [::]:23                                                                      [::]:*
tcp   LISTEN     0      128                                                         [::]:10051                                                                   [::]:*

浏览器访问(ip/zabbix)

在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

缺省用户:admin 密码:zabbix

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值