CentOS7.6.1810安装Zabbix3.4-2

  1. 云栖社区>
  2. 博客>
  3. 正文

CentOS7.6.1810安装Zabbix3.4-2

megaverse 2019-05-05 16:35:36 浏览1521
展开阅读全文

系统版本:CentOS-7-x86_64-Minimal-1810.iso  (CentOS Linux release 7.6.1810 (Core) )
Zabbix版本:zabbix-release-3.4-2.el7.noarch.rpm

一、关闭selinux和firewall

1.1检测selinux是否关闭

[root@localhost ~]# getenforce 
Disabled                  #Disabled 为关闭
1.1.1临时关闭

[root@localhost ~]# setenforce 0  #设置SELinux成为Permissive模式

1.1.2永久关闭

[root@localhost ~]# vi /etc/selinux/config  
将SELINUX=enforcing改为SELINUX=disabled

永久关闭设置后需要重启才能生效

1.2查看默认防火墙状态

[root@localhost ~]# firewall-cmd --state
not running           #关闭后显示not running,开启后显示running

1.2.1停止firewall

[root@localhost ~]# systemctl stop firewalld.service

1.2.2禁止firewall开机启动

[root@localhost ~]# systemctl disable firewalld.service

二、Zabbix3.4程序安装

2.1配置zabbix的yum源

[root@localhost ~]#rpm -ivh https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

2.2安装zabbix程序包,安装mysql、zabbxi-agent

[root@localhost ~]# yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server

2.3启动mariadb并设置开机启动,创建数据库实例,授权

[root@localhost ~]# systemctl start mariadb   #启动mariadb
[root@localhost ~]# systemctl enable mariadb  #设置开机启动
[root@localhost ~]# mysql                     #登入数据库

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;   #创建数据库实例

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';   #授权所有主机访问数据库实例zabbix,用户名/密码:zabbix/zabbix

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';   #授权localhost主机名访问数据库实例zabbix,用户名/密码:zabbix/zabbix

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost.localdomain identified by 'zabbix';  #授权localhost.localdomain主机访问数据库实例zabbix,用户名/密码:zabbix/zabbix

Query OK, 0 rows affected (0.00 sec)

导入初始模式和数据

[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.15/                     #进入create.sql.gz所在目录
[root@localhost zabbix-server-mysql-3.4.4]# zcat create.sql.gz |mysql -uroot zabbix   #导入初始模式


2.4启动zabbix-server服务

2.4.1配置zabbix-server的配置文件zabbix_server.conf

[root@localhost zabbix-server-mysql-3.4.4]# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost     # 数据主机名
DBName=zabbix        # 数据库实例
DBUser=zabbix        # 用户名
DBPassword=zabbix    # 密码

2.4.2启动zabbix-server服务

[root@localhost zabbix-server-mysql-3.4.4]# systemctl start zabbix-server        #启动zabbix-server服务
[root@localhost zabbix-server-mysql-3.4.4]# systemctl enable zabbix-server       #设置zabbix-server服务开机自启动

2.5编辑Apache的配置文件,消注释设置正确的时区

[root@localhost zabbix-server-mysql-3.4.4]# vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai

启动httpd服务 ,设置开机启动httpd服务

[root@localhost ~]# systemctl start httpd     #启动httpd服务
[root@localhost ~]# systemctl enable httpd    #设置开机启动httpd服务


三、启动zabbix-agent并设置开机自启动

[root@localhost ~]# systemctl start zabbix-agent      # 启动zabbix-agent服务
[root@localhost ~]# systemctl enable zabbix-agent     # 设置zabbix-agent服务开机自启动

 

4.Zabbix Web网页安装

4.1.在浏览器输入地址http://服务器ip/zabbix/setup.php,出现欢迎界面,点击Next step;

ed241d70bbe7b427bf66564604df9165a774c775

4.2.出现必要条件检测界面,正常都是OK,点击Next step

f020f5be3454573083d141834ae46de74491c30c

4.3.配置DB连接,与zabbix_server.conf文件中主机、数据库名称、用户名、密码保持一致,点击Next step

e5468635bc97d1409288c3b0af0452a309b8ecba

4.4.zabbix服务器详细信息,点击Next step

8a2d802f40ccee7cd3194dd0d2a3f78a36b2cfae

4.5.安装前汇总,检查信息无误,点击Next step安装

468f8ad2f576a56befe901caeea910b902ec5ce4

4.6.安装成功
Congratulations! You have successfully installed Zabbix frontend.
配置文件目录
Configuration file "/etc/zabbix/web/zabbix.conf.php" created.

f8dd41dd970b83dbe47569d7997d69db09903d2f

5.zabbix网页登录

5.1. 在浏览器输入http://zabbix服务器ip/zabbix/index.php,输入管理员用户名Admin(区分大小写),默认密码zabbix,点击登入即可。

654d8f3e70e5a71981a5f1978500db8698dc55d0

网友评论

登录后评论
0/500
评论