Hello,大家好啊!
接着我们上一次的谈论,本日我要为大家先容如何在已经安装好的中科方德做事器操作系统根本上,安装和配置Zabbix 5.0。Zabbix是一个开源的监控软件工具,广泛用于监控网络和运用程序的状态和性能。它能够供应实时的监控数据,并通过图形化的界面展示,非常适宜用于企业级的环境监控。下面,我们将详细讲解安装和配置Zabbix的步骤。
在开始之前,请确保你的中科方德做事器操作系统已经更新到最新,同时具备网络连接,以便下载所需的软件包。
安装Zabbix包括几个紧张的步骤:配置Zabbix仓库、安装Zabbix做事器、前端及代理,配置数据库,以及进行初始设置。

1.查看系统信息
[root@pdsyw-server ~]# cat /etc/os-releaseNAME="NFSChina Server"VERSION="4.0 (RTM4-G312)"ID="NFS"ID_LIKE="NFSChina"VERSION_ID="4.0"PLATFORM_ID="platform:nfs4"SYSTEM_VERSION="4.0.240222"PRETTY_NAME="NFSChina Server 4.0 (RTM4-G312)"ANSI_COLOR="0;31"HOME_URL="http://www.nfschina.com"[root@pdsyw-server ~]#[root@pdsyw-server ~]# uname -aLinux pdsyw-server 4.19.113-18.106.nfs4.x86_64 #1 SMP Thu Feb 1 02:12:33 EST 2024 x86_64 x86_64 x86_64 GNU/Linux[root@pdsyw-server ~]#
2.更新源
[root@pdsyw-server ~]# dnf update
3.安装web做事器
[root@pdsyw-server ~]# dnf install httpd -y
4.启动httpd
[root@pdsyw-server ~]# systemctl start httpd[root@pdsyw-server ~]# systemctl enable httpd[root@pdsyw-server ~]# systemctl status httpd
5.安装数据库
[root@pdsyw-server ~]# dnf install mariadb-server -y
6.启动数据库
[root@pdsyw-server ~]# systemctl start mariadb[root@pdsyw-server ~]# systemctl enable mariadb[root@pdsyw-server ~]# mysql_secure_installationEnter current password for root (enter for none):Switch to unix_socket authentication [Y/n] nChange the root password? [Y/n] nRemove anonymous users? [Y/n] YDisallow root login remotely? [Y/n] nRemove test database and access to it? [Y/n] YReload privilege tables now? [Y/n] Y[root@pdsyw-server ~]#
Switch to unix_socket authentication [Y/n] n
这个提示问的是,您是否希望将 MySQL 的 root 用户认证办法切换到 unix_socket 插件。利用 unix_socket 认证许可通过操作系统用户凭据来掌握对 MySQL 数据库的访问,这意味着如果您作为操作系统的 root 用户,您可以不须要密码就通过 UNIX socket 访问 MySQL。
选择 "Y" (是): 这将配置 MySQL 的 root 用户利用 UNIX socket 认证,当您作为相同的 UNIX 用户(例如,操作系统的 root 用户)考试测验连接 MySQL 时,不须要密码。
选择 "n" (否): 如果您选择不该用 unix_socket 认证,MySQL 的 root 用户将保持利用密码认证。
哪个选项更适宜您?
如果您操持在本地机器上管理 MySQL 且更重视便捷性,且不太担心本地安全问题,利用 unix_socket 认证是个不错的选择。这在许多默认安装和配置中是推举的办法,尤其是当 MySQL 做事器不对外暴露时。
如果您须要通过网络连接到 MySQL 做事器,或者有利用密码认证的特定需求(例如,自动化脚本须要利用密码连接数据库),可能须要保留密码认证办法。
总之,选择是否切换到 unix_socket 认证取决于您的详细需求和安全考虑。在多数情形下,对付本地开拓环境,启用 unix_socket 认证供应了方便的同时也保持了安全性。对付生产环境,您可能须要更细致地考虑这个选项。
7.安装 PHP 及扩展
[root@pdsyw-server ~]# dnf install php php-cli php-common php-mysqlnd php-gd php-mbstring php-xml php-bcmath php-json -y
8.添加 Zabbix 仓库
[root@pdsyw-server ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm[root@pdsyw-server ~]# dnf clean all
9.安装 Zabbix 做事器、前端和代理
[root@pdsyw-server ~]# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent -y
10.创建初始数据库
[root@pdsyw-server ~]# mysql -uroot -pEnter password:Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 8Server version: 10.5.22-MariaDB MariaDB ServerCopyright (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.001 sec)MariaDB [(none)]> grant all privileges on zabbix. to zabbix@localhost identified by '1qaz@WSX';Query OK, 0 rows affected (0.002 sec)MariaDB [(none)]> flush privileges;Query OK, 0 rows affected (0.000 sec)MariaDB [(none)]> exit;Bye[root@pdsyw-server ~]#
11.导入初始架构和数据到 Zabbix 数据库
[root@pdsyw-server ~]# zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix
12.配置 Zabbix 做事器
[root@pdsyw-server ~]# vim /etc/zabbix/zabbix_server.conf[root@pdsyw-server ~]#[root@pdsyw-server ~]# grep DBHost= /etc/zabbix/zabbix_server.conf# DBHost=localhostDBHost=localhost[root@pdsyw-server ~]# grep DBName= /etc/zabbix/zabbix_server.conf# DBName=DBName=zabbix[root@pdsyw-server ~]# grep DBUser= /etc/zabbix/zabbix_server.conf# DBUser=DBUser=zabbix[root@pdsyw-server ~]#[root@pdsyw-server ~]# grep DBPassword= /etc/zabbix/zabbix_server.conf# DBPassword=DBPassword=1qaz@WSX[root@pdsyw-server ~]#
13.启动 Zabbix 做事器和代理
[root@pdsyw-server ~]# systemctl start zabbix-server zabbix-agent[root@pdsyw-server ~]# systemctl enable zabbix-server zabbix-agent[root@pdsyw-server ~]# systemctl status zabbix-server zabbix-agent
14.配置 PHP 为 Zabbix 前端
[root@pdsyw-server ~]# vim /etc/php-fpm.d/zabbix.conf[root@pdsyw-server ~]#[root@pdsyw-server ~]# cat /etc/php-fpm.d/zabbix.conf[zabbix]user = apachegroup = apachelisten = /run/php-fpm/zabbix.socklisten.acl_users = apache,nginxlisten.allowed_clients = 127.0.0.1pm = dynamicpm.max_children = 50pm.start_servers = 5pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 200php_value[session.save_handler] = filesphp_value[session.save_path] = /var/lib/php/sessionphp_value[max_execution_time] = 300php_value[memory_limit] = 128Mphp_value[post_max_size] = 16Mphp_value[upload_max_filesize] = 2Mphp_value[max_input_time] = 300php_value[max_input_vars] = 10000php_value[date.timezone] = Asia/Shanghai[root@pdsyw-server ~]#
15.重启 Apache 和 PHP-FPM
[root@pdsyw-server ~]# systemctl restart httpd php-fpm[root@pdsyw-server ~]# systemctl status httpd php-fpm
16.放开防火墙
[root@pdsyw-server ~]# firewall-cmd --permanent --add-port=10051/tcpsuccess[root@pdsyw-server ~]# firewall-cmd --permanent --add-port=10050/tcpsuccess[root@pdsyw-server ~]# firewall-cmd --permanent --add-service=httpsuccess[root@pdsyw-server ~]# firewall-cmd --permanent --add-service=httpssuccess[root@pdsyw-server ~]# firewall-cmd --reloadsuccess[root@pdsyw-server ~]#
17.访问 Zabbix 前端
http://192.168.80.4/zabbix
18.配置前检讨
19.配置数据库信息
20.配置zabbix做事器
21.查看配置
22.配置完成
23.登录
24.zabbix页面
25.用户设置
26.选择简体中文
27.中文界面
至此,你已经成功在中科方德做事器操作系统上安装并配置了Zabbix 5.0。通过这个强大的监控工具,你可以实时监控和管理你的IT资源,确保系统稳定运行,并及时相应各种问题。希望这篇文章对你有所帮助,如果你以为有用,请分享和转发。同时,别忘了点个关注和在看,获取更多有用的技能信息和解决方案。感谢大家的阅读,我们下次再见!