centos7如何安装部署Zabbix

参考http://www.cnblogs.com/momoshouhu/p/8041293.html

1.关闭selinux和firewall

1.1检测selinux是否关闭

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

1.1.1临时关闭
[root@localhost ~]# setenforce 0  #设置SELinux 成为enforcing模式

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

2.Zabbix3.4程序安装

2.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@bogon ~]# systemctl start mariadb  #启动mariadb
[root@bogon ~]# systemctl enable mariadb   #设置开机启动
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@bogon ~]# 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)

导入初始模式和数据

# cd /usr/share/doc/ 

# cd zabbix-server-mysql-3.4.15/         #进入create.sql.gz所在目录

[root@bogon zabbix-server-mysql-3.4.15]# zcat create.sql.gz |mysql -uroot zabbix   #导入出事模式

 2.4启动zabbix-server服务

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

[root@bogon zabbix-server-mysql-3.4.15]# vi /etc/zabbix/zabbix_server.conf 

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

[root@bogon zabbix-server-mysql-3.4.15]# 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@bogon zabbix-server-mysql-3.4.15]# systemctl start httpd    #启动httpd服务 
[root@bogon zabbix-server-mysql-3.4.15]# systemctl enable httpd          #设置开机启动httpd服务
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

3.启动zabbix-agent并设置开机自启动

[root@bogon zabbix-server-mysql-3.4.15]# systemctl start zabbix-agent     # 启动zabbix-agent服务
[root@bogon zabbix-server-mysql-3.4.15]# systemctl enable zabbix-agent        # 设置zabbix-agent服务开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.

4.Zabbix Web网页安装

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

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

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

4.4.zabbix服务器详细信息,点击下一步

4.5.安装前汇总,检查信息无误,点击下一步安装

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

5zabbix网页登录

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

若长生难求以命为注 方冥冥如悟因果殊途 --《长生》
原文地址:https://www.cnblogs.com/hc1hr2/p/10071749.html