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