图文详解CentOS7下安装Zabbix3.2

centOS7下zabbix-server和zabbix-agent的安装;

windows7下zabbix-agent的安装;

图文详情请下载附件。

一、zabbix-server安装
#服务器ip地址:192.168.37.144
1.zabbix-server安装
#安装zabbix仓库

#安装zabbix服务器端
yum install zabbix-server-mysql zabbix-web-mysql -y
#安装zabbix客户端,此处的目的是希望zabbix可以监控自己
yum install zabbix-agent -y
 
2.数据库安装与配置
#安装mariadb数据库
yum install mariadb*
 
#启动mariadb
systemctl start mariadb.service
 
#设置mariadb为开机启动
systemctl enable mariadb.service
 
#设置mariadb相关参数
 vi /etc/my.cnf
  1. [mysqld]
  2. datadir=/var/lib/mysql
  3. socket=/var/lib/mysql/mysql.sock
  4. symbolic-links=0
  5. character-set-server=utf8 #设置字符集编码
  6. wait_timeout=288000#链接超时
  7. lower_case_table_names=1#不区分列名称的大小写
  8. innodb_file_per_table=1#让innodb每个表文件单独存储
#重启mariadb
systemctl restart mariadb.service
#登录mariadb,默认密码为空,需要设置
mysql -uroot -p  
 
#设置root密码
mysqladmin -uroot password admin #此处设置密码为admin
 
#创建zabbix数据库
MariaDB [(none)]> create database zabbix character set utf8; #注意必须设置为utf-8,否则会出现中文乱码。
 
#创建zabbix用户,并授予其对zabbix的管理权限
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; 
MariaDB [(none)]> flush privileges;
 
#导入zabbix初始化脚本
cd /usr/share/doc/zabbix-server-mysql-3.2.1/
gunzip create.sql.gz
mysql -uzabbix -p
MariaDB [(none)]> use zabbix;
MariaDB [zabbix]> source  /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql;
 
#配置zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf 
基于上面的配置,只需要修改:DBPassword=zabbix
一般情况下需要修改如下配置项:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
 
3.zabbix-server服务启动与配置
#启动zabbix-server服务,并配置为开机启动
systemctl start zabbix-server
systemctl enable zabbix-server
 
#启动httpd服务,并设置为开机启动
systemctl start httpd
systemctl enable httpd
 
#修改防火墙端口
#关闭Selinux,firewalld
#开启iptablse
#服务器端开放端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT
#客户端开放端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 10050 -j ACCEPT
-A OUTPUT -p tcp -m state --state NEW -m tcp --dport 10051 -j ACCEPT
#重启iptables:systemctl restart iptables.service 
 
#apache配置:zabbix配置文件
vim /etc/httpd/conf.d/zabbix.conf
#默认情况下只需修改时区
php_value date.timezone Asia/Shanghai
 
#重启httpd
systemctl restart httpd
 
4.web管理端初始化配置
#访问页面

猜你喜欢

转载自hanqunfeng.iteye.com/blog/2337496