1.配置zabbix源
[root@zabbix-server~]#rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
2.修改配置文件
[root@zabbix-server ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
3.安装zabbix服务端和zabbix-web前端
[root@zabbix-server ~]# yum install zabbix-server-mysql zabbix-web-mysql -y
4.安装mariadb,创建zabbix库,授权zabbix用户
[root@zabbix-server ~]# yum install mariadb-server -y
[root@zabbix-server ~]# systemctl start mariadb
[root@zabbix-server ~]# systemctl enable mariadb
[root@zabbix-server ~]# mysql_secure_installation (初始化设置)
回车 设置当前 root密码
n 是否设置root密码
y 要移除匿名用户嘛
y 要取消root远程登录权限嘛
y 要删掉test库嘛
y 要刷新权限嘛
创建zabbix库,授权zabbix用户
[root@zabbix-server ~]# mysql
>:create database zabbix character set utf8 collate utf8_bin;
>:grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
导入zabbix表结构和初始数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
检查zabbix库是否导入成功
mysql -uroot zabbix -e 'show tables'
5.配置启动zabbix-server
[root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf (配置文件相同的改成如下)
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动zabbix-server
systemctl start zabbix-server
systemctl enable zabbix-server
检查:
netstat -lntup
[root@zabbix-server ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 3882/zabbix_server
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 3768/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1212/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1293/master
tcp6 0 0 :::10051 :::* LISTEN 3882/zabbix_server
tcp6 0 0 :::80 :::* LISTEN 4047/httpd
tcp6 0 0 :::22 :::* LISTEN 1212/sshd
tcp6 0 0 ::1:25 ::* LISTEN 1293/master
6.修改Zabbix前端的PHP配置,并启动httpd
[root@zabbix-server ~]# vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
启动httpd
systemctl start httpd
systemctl enable httpd
网友评论