一.准备工作
OS:centos7.4
Zabbix version:3.4.6(2018/1/15日上线的新版本)
Database:MariaDB
关闭防火墙:
systemctl stop firewalld
防火墙开机不自启:
systemctl disable firewalld
关闭selinux:
临时:setenforce 0
永久:sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
一切准备好后,重启系统!
reboot
二.先安装MariaDB数据库
1)yum安装MariaDB
yum -y install mariadb-server mariadb
2)启动和开机自启数据库
systemctl start mariadb && systemct
l enable mariadb
3)安装zabbix3.4.6
3.1 先rpm安装zabbix的yum源
rpm -i
3.2 开始安装zabbix
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-get zabbix-sender
3.3 创建初始数据库
mysql -uroot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit
3.4 创建初始数据库
mysql -uroot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit
导入初始模式和数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
为Zabbix服务器配置数据库:
[root@Rich七哥 log]# vim /etc/zabbix/zabbix_server.conf
(修改前)
/etc/zabbix/zabbix_server.conf:38:LogFile=http://www.likecs.com/var/log/zabbix/zabbix_server.log
/etc/zabbix/zabbix_server.conf:49:LogFileSize=0
/etc/zabbix/zabbix_server.conf:72:PidFile=http://www.likecs.com/var/run/zabbix/zabbix_server.pid
/etc/zabbix/zabbix_server.conf:82:SocketDir=http://www.likecs.com/var/run/zabbix
/etc/zabbix/zabbix_server.conf:91:# DBHost=localhost
/etc/zabbix/zabbix_server.conf:102:### Option: DBSchema
/etc/zabbix/zabbix_server.conf:117:
/etc/zabbix/zabbix_server.conf:125:
/etc/zabbix/zabbix_server.conf:330:
/etc/zabbix/zabbix_server.conf:448:### Option: TrapperTimeout
/etc/zabbix/zabbix_server.conf:490:### Option: ExternalScripts
/etc/zabbix/zabbix_server.conf:500:### Option: FpingLocation
/etc/zabbix/zabbix_server.conf:536:### Option: TmpDir
[root@Rich七哥 log]# grep -n '^' [a-Z] /etc/zabbix/zabbix_server.conf
(修改后)
mysql -uroot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit
3.4 创建初始数据库
mysql -uroot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit
导入初始模式和数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
为Zabbix服务器配置数据库:
[root@Rich七哥 log]# vim /etc/zabbix/zabbix_server.conf
(修改前)
/etc/zabbix/zabbix_server.conf:38:LogFile=http://www.likecs.com/var/log/zabbix/zabbix_server.log
/etc/zabbix/zabbix_server.conf:49:LogFileSize=0
/etc/zabbix/zabbix_server.conf:72:PidFile=http://www.likecs.com/var/run/zabbix/zabbix_server.pid
/etc/zabbix/zabbix_server.conf:82:SocketDir=http://www.likecs.com/var/run/zabbix
/etc/zabbix/zabbix_server.conf:91:# DBHost=localhost
/etc/zabbix/zabbix_server.conf:102:### Option: DBSchema
/etc/zabbix/zabbix_server.conf:117:
/etc/zabbix/zabbix_server.conf:125:
/etc/zabbix/zabbix_server.conf:330:
/etc/zabbix/zabbix_server.conf:448:### Option: TrapperTimeout
/etc/zabbix/zabbix_server.conf:490:### Option: ExternalScripts
/etc/zabbix/zabbix_server.conf:500:### Option: FpingLocation
/etc/zabbix/zabbix_server.conf:536:### Option: TmpDir
[root@Rich七哥 log]# grep -n '^' [a-Z] /etc/zabbix/zabbix_server.conf
(修改后)
mysql -uroot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit
3.4 创建初始数据库
mysql -uroot
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]> quit
导入初始模式和数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
为Zabbix服务器配置数据库:
[root@Rich七哥 log]# vim /etc/zabbix/zabbix_server.conf
(修改前)
/etc/zabbix/zabbix_server.conf:38:LogFile=http://www.likecs.com/var/log/zabbix/zabbix_server.log
/etc/zabbix/zabbix_server.conf:49:LogFileSize=0
/etc/zabbix/zabbix_server.conf:72:PidFile=http://www.likecs.com/var/run/zabbix/zabbix_server.pid
/etc/zabbix/zabbix_server.conf:82:SocketDir=http://www.likecs.com/var/run/zabbix
/etc/zabbix/zabbix_server.conf:91:# DBHost=localhost
/etc/zabbix/zabbix_server.conf:102:### Option: DBSchema
/etc/zabbix/zabbix_server.conf:117:
/etc/zabbix/zabbix_server.conf:125:
/etc/zabbix/zabbix_server.conf:330:
/etc/zabbix/zabbix_server.conf:448:### Option: TrapperTimeout
/etc/zabbix/zabbix_server.conf:490:### Option: ExternalScripts
/etc/zabbix/zabbix_server.conf:500:### Option: FpingLocation
/etc/zabbix/zabbix_server.conf:536:### Option: TmpDir
[root@Rich七哥 log]# grep -n '^' [a-Z] /etc/zabbix/zabbix_server.conf
(修改后)