环境: CentOS7 机器 两台 分别为 server 和 client
zabbix 下载网址: http://repo.zabbix.com
本次操作使用 zabbix4.0 网址: http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
操作: rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm (下载解压)
- [[email protected] ~]# cat /etc/yum.repos.d/zabbix.repo
- [zabbix]
- name=Zabbix Official Repository - $basearch
- baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
- [zabbix-non-supported]
- name=Zabbix Official Repository non-supported - $basearch
- baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
- enabled=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
- gpgcheck=1
安装 zabbix 相关组件
yum -y install zabbix-server-MySQL zabbix-web-MySQL zabbix-agent mariadb mariadb-server
启动数据库, 设置开机自启
- systemctl enable mariadb.service
- systemctl start mariadb.service
登录 MySQL, 并创建 zabbix 数据库, 授权用户, 用以登录 zabbix 数据库
- [[email protected] ~]# MySQL
- Welcome to the MariaDB monitor. Commands end with ; or \g.
- Your MariaDB connection id is 2
- Server version: 5.5.64-MariaDB MariaDB Server
- Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
创建名为 zabbix 的库
- MariaDB [(none)]> create database zabbix charset 'utf8';
- Query OK, 1 row affected (0.00 sec)
授权 zabbix 用户在 任意主机访问 zabbix 库
- MariaDB [(none)]> grant all on zabbix.* to [email protected] identified by '123';
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [(none)]>
导入 zabbix 初始数据库 注意路径, 不同版本 zabbix 路径名大同小异
zcat /usr/share/doc/zabbix-server-MySQL-4.0.14/create.sql.gz |MySQL -uzabbix -p123 zabbix
编辑 zabbix-server 配置文件, 配置数据库信息
- [[email protected] ~]# cat /etc/zabbix/zabbix_server.conf |grep "^DB"
- DBHost=localhost
- DBName=zabbix
- DBUser=zabbix
- DBPassword=123
设置时区
进入 PHP.INI 配置
- VIM /etc/PHP.INI
- ;http://php.net/date.timezone
- date.timezone = Asia/Shanghai
下一步, 启动所有服务
- systemctl enable httpd zabbix-server zabbix-ahent
- systemctl start httpd zabbix-server zabbix-agent
查看相关端口是否监听 server 监听 10051 client 监听 10050
- netstat -ntlp | grep 10051 (server 监听)
- netstat -ntlp | grep 10050 (client 监听)
浏览器访问本机 ip, 注意关闭防火墙
http://localhost/zabbix
使用默认管理员登录
账号: admin
密码: zabbix
中文乱码问题解决方式:
将我们选择的字体文件上传到 zabbix Web 服务, /usr/share/zabbix/assets/fonts 目录下 (rpm 安装目录)
- rm -rf graphfont.ttf
- mv simkai.ttf graphfont .ttf
授权 644
chmod 644 graphfont.ttf
来源: http://www.bubuko.com/infodetail-3333192.html