在 CentOS 8 上安装 Zabbix 4.4

在 CentOS 8 上安装 Zabbix 4.4

配置操作系统

重命名计算机名:

[root@localhost ~]# vim /etc/hostname 

配置 SELinux:

[root@localhost ~]# vim /etc/selinux/config 

更改:

SELINUX=disabled

配置防火墙:为了方便,我这里选择直接关闭防火墙;

[root@localhost ~]# systemctl stop firewalld.service 

[root@localhost ~]# systemctl disable firewalld.service 

* Zabbix 需要打开的防火墙端口分别为:80/443,10050 和 10051,你也可以使用 “firewall-cmd” 命令去单独修改防火墙端口,这里为了后续试验方便,直接把防火墙给关了。

配置网络:设置固定 IP 地址;

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens192

更改:

BOOTPROTO="static"

添加:

IPADDR=10.10.10.50
NETMASK=255.255.255.0
GATEWAY=10.10.10.1
DNS1=10.10.10.5

重启计算机:

[root@localhost ~]# reboot

安装 Zabbix

更新系统:

[root@zabbix ~]# yum update -y

安装必要组件:

[root@zabbix ~]# dnf install -y httpd mysql-server php php-mysqlnd php-mbstring php-pdo php-gd

开启必要组件的服务:

[root@zabbix ~]# systemctl enable --now httpd.service

[root@zabbix ~]# systemctl enable --now mysqld.service

更改 HTTP 时区

[root@zabbix ~]# vim /etc/php.ini

设置:

date.timezone = Asia/Shanghai

初始化数据:配置数据库密码(MySQL 的密码)

[root@zabbix ~]# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 

创建并配置数据库:创建一个名为 zabbix 的数据,并为这个数据库创建一个名为 zabbix 的用户,并设置密码为 “Shanghai2010@”,然后为这个用户赋予 zabbix 数据库的完全权限。配置完成后退出数据。

[root@zabbix tmp]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.17 Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database zabbix character set UTF8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.19 sec)

mysql> create user 'zabbix'@'localhost' identified by 'Shanghai2010@';
Query OK, 0 rows affected (0.08 sec)

mysql> grant ALL on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.17 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye

安装 Zabbix yum 库:

[root@zabbix ~]# wget https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm

[root@zabbix ~]# dnf install -y zabbix-release-4.4-1.el8.noarch.rpm

[root@zabbix ~]# dnf makecache

安装 Zabbix 服务器组件

[root@zabbix ~]# dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf

使用Zabbix服务器安装文件中提供的脚本创建Zabbix存储库。

[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -D zabbix -pShanghai2010@

配置 Zabbix 服务器

[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf

设置:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=Shanghai2010@

* DBName 与 DBUser 有默认选项,并且都为 zabbix。

安装 Zabbix Agent

[root@zabbix ~]# dnf install -y zabbix-agent

启动服务

[root@zabbix ~]# systemctl enable --now zabbix-server

[root@zabbix ~]# systemctl enable --now zabbix-agent

重启计算机:

[root@zabbix ~]# reboot

配置 Zabbix 完成安装

在浏览器中输入 “http://<Zabbix Server Name or IP Address>/zabbix”

点击 ”Next Step“
在这里插入图片描述

点击 “Next Step”
在这里插入图片描述

输入 zabbix 数据库的密码,然后点击 ”Next Step“
在这里插入图片描述

点击 ”Next Step”
在这里插入图片描述

点击 “Next Step”
在这里插入图片描述

点击 “Finish”
在这里插入图片描述

输入用户名和密码。Zabbix 默认的用户名是 ”Admin“,密码是 ”zabbix“。注意其中用户名中的 ”A“ 是大写。
在这里插入图片描述

进入 Zabbix 的 Dashboard
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值