zabbix 4.0的安装
首先准备一台虚拟机
1 关闭防火墙和selinux
systemctl stop firewalld.service
setenforce 0
这里是centos-7上
2 配置zabbix的yum源 zabbix.repo
cd /etc/yum.repos.d/
vim zabbix.repo
在里面编写
1 [zabbix]
2 name=Zabbix Official Repository - $basearch
3 baseurl=http://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/
4 enabled=1
5 gpgcheck=0
6 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
7
8 [zabbix-debuginfo]
9 name=Zabbix Official Repository debuginfo - $basearch
10 baseurl=http://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/debuginfo/
11 enabled=0
12 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
13 gpgcheck=0
14
15 [zabbix-non-supported]
16 name=Zabbix Official Repository non-supported - $basearch
17 baseurl=http://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
18 enabled=1
19 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
20 gpgcheck=0
3 安装zabbix的相关组件
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb mariadb-server
设置自启并启动数据库
systemctl enable mariadb.service
systemctl start mariadb.service
登录mysql
character set utf8 collate utf8_bin:数据库字符集和一个数据库校对规则
1 mariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; #创建一个数据库
2
3 mariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; #给zabbix用户授权
4
5 mariaDB [(none)]> flush privileges; # 刷新权限
导入zabbix初始数据库
zcat /usr/share/doc/zabbix-server-mysql-4.4.8/create.sql.gz | mysql -uzabbix -pzabbix zabbix;
这里的数据库密码名称可以自定义
编辑zabbix-server配置文件,配置数据库信息
1 [root@bogon ~]# vim /etc/zabbix/zabbix_server.conf
2 [root@bogon ~]# cat /etc/zabbix/zabbix_server.conf |grep "^DB"
3 DBHost=localhost
4 DBName=zabbix
5 DBUser=zabbix
6 DBPassword=zabbix
7 [root@bogon ~]#
启动所有服务
[root@bogon ~]# systemctl enable httpd zabbix-server zabbix-agent
[root@bogon ~]# systemctl start httpd zabbix-server zabbix-agent
修改时区,php.ini配置文件
1 [root@bogon ~]# vim /etc/php.ini
2 [root@bogon ~]# cat /etc/php.ini |grep -w 'date.timezone'
3 ; http://php.net/date.timezone
4 date.timezone = Asia/Shanghai #首字母要大写
5 [root@bogon ~]#
查看相关端口是否监听:10050和10051是否存在
1 [root@bogon ~]# netstat -ntlp | grep zabbix
2 tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 66302/zabbix_agentd
3 tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 66309/zabbix_server
4 tcp6 0 0 :::10050 :::* LISTEN 66302/zabbix_agentd
5 tcp6 0 0 :::10051 :::* LISTEN 66309/zabbix_server
6 [root@bogon ~]#
浏览器访问:ip/zabbix ip是自己本机的ip
见上文,修改完成后重启httpd 之后刷新页面
将其页面修改为中文