我是初学者,不会编译安装只能使用yum安装以下教程

以下有说错的地方请给位看完纠正一下,谢谢各位。

Install Zabbix 3.0 (Monitoring Server) on CentOS 7.x

Zabbix is a free and open source monitoring tool which is used to monitor and track the availability & performance of servers, network devices and other IT assets which are on network.

Zabbix uses database like MySQL, MariaDB, Oracle and IBM DB2 to store its data. Zabbix web interface is written in PHP.


Some of its key features are listed below :

  • Monitor everything which is on network like Servers, applications, database instance and network devices.

  • Zabbix provides Web based administration interface.

  • Monitoring CPU utilization of a particular process or a group of process ( proc.cpu.util)

  • Using low-level discovery rules, zabbix can discover Vmware hypervisor ( ESXI ) and Virtual machines.

  • Zabbix also supports agentless monitoring

  • Monitoring of database servers like MySQL, PostgreSQL, Oracle and Microsoft SQL Server.

  • Zabbix can also perform the task of capacity planning for your environment.

  • Zabbix is Open Source so no cost involved and can be deployed on small and large environment.

  • Hardware Monitoring using Zabbix via IPMI credentials.

  • Network Device monitoring using snmp agents.

这是我安装zabbix的系统及网络环境

  • Hostname = zabbix.localhost

  • IP Address = 192.168.12.131

  • OS = CentOS 7.x 

开始安装前先更新一下现有系统

[root@zabbix ~]# yum -y update
[root@zabbix ~]# reboot

第一步启用EPEL zabbix 库

Zabbix package is not available in the default yum repository, so we will enable zabbix  and epel repository using below commands.

[root@zabbix ~]# yum install epel-release
[root@zabbix ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

第二步安装zabbix Server,database(数据库)Web服务器我使用的是Apache PHP

使用下面命令安装

[root@zabbix ~]# yum -y install zabbix-server-mysql zabbix-web-mysql mysql mariadb-server httpd php

第三步配置Zabbix数据库

Start the Database (MariaDB) service

[root@zabbix ~]# systemctl start mariadb
[root@zabbix ~]# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
[root@zabbix ~]#

  运行mysql_secure_installation会执行几个设置:

  为root用户设置密码 ,删除匿名账号取消root用户远程登录,删除test库和对test库的访问权限,刷新授权表使修改生效

[root@zabbix ~]# mysql_secure_installation

创建zabbix数据库"zabbix_db"和zabbix用户“zabbix_user”和授予权限给所有在Zabbix数据库用户。

[root@zabbix ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, 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_db;
Query OK, 1 row affected (0.00 sec)

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

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[root@zabbix ~]#

讲zabbix数据库导入到mysq

Now import the database Schema using below commands.

[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-3.0.1
[root@zabbix zabbix-server-mysql-3.0.1]# gunzip create.sql.gz
[root@zabbix zabbix-server-mysql-3.0.1]# mysql -u root -p zabbix_db < create.sql
Enter password:
[root@zabbix zabbix-server-mysql-3.0.1]#

第四步 编辑zabbix Server 配置文件

[root@zabbix ~]# vi /etc/zabbix/zabbix_server.conf
...................................
DBHost=localhost   主机名称
DBName=zabbix_db   数据库名称
DBUser=zabbix_user 数据库用户名
DBPassword=XXXXXXX 数据库密码   X---代表自定义
...................................

保存并退出

配置PHP设置

Set the below parameters in the PHP config file (/etc/php.ini )

[root@zabbix ~]# vi /etc/php.ini
................................
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M
date.timezone = Asia/Kolkata
...............................

设置防火墙

[root@zabbix ~]# firewall-cmd --permanent --add-port=10050/tcp
success
[root@zabbix ~]# firewall-cmd --permanent --add-port=10051/tcp
success
[root@zabbix ~]# firewall-cmd --permanent --add-port=80/tcp
success
[root@zabbix ~]# firewall-cmd --reload 
success
[root@zabbix ~]# systemctl restart firewalld
[root@zabbix ~]#

Set the below Selinux rule.

设置Selinux 规则

[root@zabbix ~]# setsebool -P httpd_can_connect_zabbix=1
[root@zabbix ~]#

备注:转上一篇文章关于关闭SELINUX的方法

selinux 是否关闭

查看/etc/selinux/config有以下三个选项选择SELINUX = disabled

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.


启动Zabbix和Web服务器的服务并确保它使整个启动。

[root@zabbix ~]# systemctl start zabbix-server
[root@zabbix ~]# systemctl enable zabbix-server
ln -s '/usr/lib/systemd/system/zabbix-server.service' '/etc/systemd/system/multi-user.target.wants/zabbix-server.service'
[root@zabbix ~]# 
[root@zabbix ~]# systemctl start httpd
[root@zabbix ~]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@zabbix ~]#

第五步在浏览器输入http://192.168.12.131/zabbix/

    请更换你使用zabbix的服务器IP地址或主机名


点击Click on ‘Next step’

检查zabbix配置


点击‘Next step’配置数据库主机名数据库名称端口数据库用户名密码


Click on ‘Next step’ to continue.

Specify the Zabbix Server details and Port number.


Click on ‘Next step’ to continue.

Pre-installation summary of Zabbix Servers, click on ‘Next step’ to continue.

看到下个画面恭喜你安装成功了

当我们点击 ‘finish’,它将引导我们Zabbix Web界面控制台。

使用用户名为“admin”和密码“Zabbix”