文章目录
FYI 官网:
https://www.zabbix.com/cn/download
1.先更新yum源
[root@VM_0_7_centos ~]# yum update
2.安装zabbix
[root@VM_0_7_centos ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.tLx2vh: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-4.0-1.el7 ################################# [100%]
[root@VM_0_7_centos ~]# yum clean all
3. 安装Zabbix server,Web前端,agent
[root@VM_0_7_centos ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
4.创建数据库并导入
[root@VM_0_7_centos ~]# yum install mariadb-server mariadb –y
[root@VM_0_7_centos ~]# systemctl start mariadb.service
[root@VM_0_7_centos ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@VM_0_7_centos ~]# systemctl start httpd
[root@VM_0_7_centos ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@VM_0_7_centos ~]#
数据库默认密码为空
[root@VM_0_7_centos ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-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.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
导入初始架构和数据,系统将提示您输入新创建的密码。
[root@VM_0_7_centos ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.5/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@VM_0_7_centos ~]#
5.为Zabbix server配置数据库,启用DBPassword并填写zabbix密码
[root@VM_0_7_centos ~]# vim /etc/zabbix/zabbix_server.conf
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=zabbix
6.编辑配置文件并修改时区
[root@VM_0_7_centos ~]# vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
7.启动Zabbix server和agent,并设置开机自启
[root@VM_0_7_centos ~]# systemctl restart zabbix-server zabbix-agent
[root@VM_0_7_centos ~]# systemctl enable zabbix-server zabbix-agent
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
[root@VM_0_7_centos ~]#
8.配置Zabbix前端
连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix
用户名:Admin
密码:zabbix