Zabbix第三章(安装)
zabbix安装
1、时间同步、配置主机名/解析、SELinux/firewalld关闭
2、配置zabbix运行环境
- 配置yum源文件
[ ~]# cat /etc/yum.repos.d/cent.repo
[ ~]# cat /etc/yum.repos.d/centos.repo
[centos]
name=centos
baseurl=ftp://172.16.8.100/centos7u2
enabled=1
gpgcheck=0
[zabbix]
name=zabbix
baseurl=file:///zabbix
enabled=1
gpgcheck=0
- 安装依赖的软件
[ ~]# yum install -y httpd mariadb mariadb-server mariadb-devel libdbi-dbd-mysql net-snmp net-snmp-devel net-snmp-utils curl-devel mod_ssl mod_auth_mysql mod_perl
- 开启各项服务并设置为开机自动启动
[ ~]# systemctl start httpd
[ ~]# systemctl enable httpd
[ ~]# systemctl start mariadb
[ ~]# systemctl enable mariadb
- 安装zabbix服务端
[ ~]# yum install -y zabbix-server-mysql zabbix-web zabbix-web-mysql
- 创建并初始化zabbix数据库
mysql> CREATE DATABASE zabbix CHARACTER SET utf8;
mysql> GRANT all ON zabbix.* TO ‘zabbixuser‘@‘localhost‘ IDENTIFIED BY ‘redhat‘;
mysql> FLUSH PRIVILEGES;
- 导入数据表
[ ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.1/
[ zabbix-server-mysql-3.2.1]# zcat create.sql.gz | mysql -u root -p zabbix
登陆mysql查询是否登陆成功(127张表)
7) 在zabbix_server.conf文件中编辑数据库相关配置
[ ~]# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbixuser
DBPassword=redhat
DBSocket=/var/lib/mysql/mysql.sock
8) 启动Zabbix Server并配置其开机启动
[ ~]# systemctl start zabbix-server
[ ~]# systemctl enable zabbix-server
[ ~]# netstat -antp | grep zabbix
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 5909/zabbix_server
tcp 0 0 :::10051 ::?? LISTEN 5909/zabbix_server
[ ~]#
- 编辑zabbix.conf配置文件,指定PHP的时区
[ zabbix-web-3.2.1]# vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
[ ~]# systemctl restart httpd