CentOS7下安装部署“zabbix”
一、基础环境配置
1.关闭selinux
setenforce 0 #临时关闭
sed -i s#'SELINUX=enforcing'#'SELINUX=disabled'#g /etc/selinux/config #永久关闭,重启生效
2.关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
3.LAMP环境部署
安装apache
yum install httpd -y
systemctl enable httpd
systemctl start httpd
安装mariadb
yum install -y mariadb mariadb-server
systemctl enable mariadb
systemctl start mariadb
安装php
yum install -y php php-mysql
二、zabbix的安装
1.下载软件包
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2.安装zabbix
yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
3.创建一个名为zabbix的数据库并设置为utf8的字符编码格式
mysql
create database zabbix character set utf8 collate utf8_bin;
4.创建账户并且授权设置密码
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
#刷新
flush privileges;
exit
5.导入表
cd /usr/share/doc/zabbix-server-mysql-3.4.15/
gunzip create.sql.gz
mysql
use zabbix;
source create.sql
exit
6.编辑zabbix配置文件
cd /etc/zabbix
vim zabbix_server.conf
91行“DBHost=localhost”取消注释
或者改为DBHost=127.0.0.1
125行“DBPassword=zabbix”
132行“DBSocket=/var/lib/mysql/mysql.sock”
7.启动zabbix
systemctl enable zabbix-server.service
systemctl start zabbix-server.service
8.配置php
vim /etc/httpd/conf.d/zabbix.conf
21行增加“php_value date.timezone Asia/Shanghai”
#保存退出
systemctl restart httpd
9.登录zabbix进行安装
ip:port/zabbix
数据库密码:zabbix
登录账号:Admin,密码:zabbix