heniancheng 2020-05-17
1、时间同步、配置主机名/解析、SELinux/firewalld关闭
2、配置zabbix运行环境
[ ~]# 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
[ ~]# yum install -y zabbix-server-mysql zabbix-web zabbix-web-mysql
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-web-3.2.1]# vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
[ ~]# systemctl restart httpd