0
点赞
收藏
分享

微信扫一扫

AcWing 795. 前缀和——算法基础课题解

原文链接:中科方德服务器操作系统安装zabbix5.0
Hello,大家好啊!接着我们上一次的讨论,今天我要为大家介绍如何在已经安装好的中科方德服务器操作系统基础上,安装和配置Zabbix 5.0。Zabbix是一个开源的监控软件工具,广泛用于监控网络和应用程序的状态和性能。它能够提供实时的监控数据,并通过图形化的界面展示,非常适合用于企业级的环境监控。下面,我们将详细讲解安装和配置Zabbix的步骤。

准备工作

在开始之前,请确保你的中科方德服务器操作系统已经更新到最新,同时具备网络连接,以便下载所需的软件包。

安装Zabbix 5.0

安装Zabbix包括几个主要的步骤:配置Zabbix仓库、安装Zabbix服务器、前端及代理,配置数据库,以及进行初始设置。

  1. 添加Zabbix仓库:首先,我们需要添加Zabbix的官方仓库。
  2. 安装Zabbix服务器、前端和代理: 使用包管理器安装Zabbix服务器、前端以及代理。这将自动处理大部分依赖关系。
  3. 配置数据库:Zabbix需要一个数据库来存储数据。你可以选择MySQL或PostgreSQL作为数据库。创建数据库并为Zabbix配置,接着导入初始数据和表结构。
  4. 配置PHP:编辑Zabbix前端的PHP配置文件,调整必要的PHP参数,例如时区等。
  5. 启动Zabbix服务并设置开机自启: 启动Zabbix服务器和代理服务,并确保它们设置为开机自启。
  6. 访问Zabbix前端:最后,通过浏览器访问Zabbix前端进行初始设置。一般可以通过服务器的IP地址加上/zabbix来访问,例如http://your_server_ip/zabbix。跟随Web界面的指引完成Zabbix的初始配置。

1.查看系统信息

[root@pdsyw-server ~]# cat /etc/os-release
NAME="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 -a
Linux 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_installation

Enter current password for root (enter for none):

Switch to unix_socket authentication [Y/n] n

Change the root password? [Y/n] n

Remove anonymous users? [Y/n] Y

Disallow root login remotely? [Y/n] n

Remove test database and access to it? [Y/n] Y

Reload 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 -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.5.22-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.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=localhost
DBHost=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 = apache
group = apache

listen = /run/php-fpm/zabbix.sock
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 200

php_value[session.save_handler] = files
php_value[session.save_path]    = /var/lib/php/session

php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000
php_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/tcp
success
[root@pdsyw-server ~]# firewall-cmd --permanent --add-port=10050/tcp
success
[root@pdsyw-server ~]# firewall-cmd --permanent --add-service=http
success
[root@pdsyw-server ~]# firewall-cmd --permanent --add-service=https
success
[root@pdsyw-server ~]# firewall-cmd --reload
success
[root@pdsyw-server ~]#

17.访问 Zabbix 前端

18.配置前检查

19.配置数据库信息

20.配置zabbix服务器

21.查看配置

22.配置完成

23.登录

24.zabbix页面

25.用户设置

26.选择简体中文

27.中文界面

至此,你已经成功在中科方德服务器操作系统上安装并配置了Zabbix 5.0。通过这个强大的监控工具,你可以实时监控和管理你的IT资源,确保系统稳定运行,并及时响应各种问题。希望这篇文章对你有所帮助,如果你觉得有用,请分享和转发。同时,别忘了点个关注和在看,获取更多有用的技术信息和解决方案。感谢大家的阅读,我们下次再见!

举报

相关推荐

0 条评论