Centos7部署Zabbix

1.关闭selinux和firewall

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

[root@localhost ~]# vi /etc/selinux/config:   

将SELINUX=enforcing改为SELINUX=disabled 

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

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


2、安装环境和程序包

[root@localhost ~]#yum -y install mariadb mariadb-server php php-mysql httpd2.1配置zabbix的yum源

[root@localhost ~]# rpm -ivh http://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;   #创建数据库实例

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

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

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

导入初始模式和数据

[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.4/              #进入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 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服务


3.启动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

image.png

image.png

image.png

image.png

image.png

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


猜你喜欢

转载自blog.51cto.com/10923272/2328040