如何在 Fedora 37 上安装 Graylog

Linux命令 Edge插件网 2年前 (2023-04-11) 658次浏览 已收录 0个评论

我们将向您展示如何在 Fedora 37安装 Graylog。您是否正在努力管理和分析 Fedora 37 系统上各种来源的日志?如果是这样,Graylog可能是您一直在寻找的解决方案。Graylog 是一个开源日志管理系统,可以收集、索引和分析来自不同来源的大量日志数据。它提供了一个用于搜索、分析和可视化日志数据的集中式平台,使其成为任何系统管理员的必备工具。

如何在 Fedora 37 上安装 Graylog

在 Fedora 37 上安装 Graylog

第 1 步。在继续之前,请更新您的 Fedora 操作系统以确保所有现有软件包都是最新的。使用此命令更新服务器软件包:

<span class="pln">sudo dnf upgrade
sudo dnf update</span>

第 2 步。安装爪哇。

Elasticsearch 依赖于 Java,在 Fedora 上安装 Elasticsearch 之前,您需要在机器上安装它。运行以下命令以安装 OpenJDK 包:

<span class="pln">sudo dnf install java</span><span class="pun">-</span><span class="lit">11</span><span class="pun">-</span><span class="pln">openjdk</span>

使用以下命令验证 Java 版本:

<span class="pln">java </span><span class="pun">-</span><span class="pln">version</span>

第 3 步。安装 Elasticsearch。

默认情况下,Elasticsearch 在 Fedora 37 基础存储库中不可用。现在我们将 Elasticsearch RPM 存储库添加到您的 Fedora 系统中:

<span class="pln">sudo rpm </span><span class="pun">--</span><span class="kwd">import</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//artifacts.elastic.co/GPG-KEY-elasticsearch</span><span class="pln">

echo </span><span class="str">"[elasticsearch-7.10.2]
name=Elasticsearch repository for 7.10.2 packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md"</span> <span class="pun">|</span><span class="pln"> sudo tee </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">elasticsearch</span><span class="pun">.</span><span class="pln">repo</span>

接下来,导入 Elasticsearch GPG 密钥:

<span class="pln">rpm </span><span class="pun">--</span><span class="kwd">import</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//artifacts.elastic.co/GPG-KEY-elasticsearch</span>

完成后,在 Fedora 系统上安装 Elasticsearch 软件包:

<span class="pln">sudo dnf update
sudo yum install elasticsearch</span><span class="pun">-</span><span class="pln">oss</span>

安装完成后,现在启用 Elasticsearch(在系统启动时自动启动)、启动并使用以下命令验证状态:

<span class="pln">sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
sudo systemctl status elasticsearch</span>

第 4 步。安装 MongoDB。

现在我们运行以下命令在 Fedora 系统上添加 MongoDB 仓库:

<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mongodb</span><span class="pun">-</span><span class="pln">org</span><span class="pun">.</span><span class="pln">repo</span>

添加以下文件:

<span class="pun">[</span><span class="pln">mongodb</span><span class="pun">-</span><span class="pln">org</span><span class="pun">-</span><span class="lit">6.0</span><span class="pun">]</span><span class="pln">
name</span><span class="pun">=</span><span class="typ">MongoDB</span> <span class="typ">Repository</span><span class="pln">
baseurl</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//repo.mongodb.org/yum/redhat/$releasever/mongodb-org/6.0/x86_64/</span><span class="pln">
gpgcheck</span><span class="pun">=</span><span class="lit">1</span><span class="pln">
enabled</span><span class="pun">=</span><span class="lit">1</span><span class="pln">
gpgkey</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//www.mongodb.org/static/pgp/server-6.0.asc</span>

之后,使用以下命令更新软件包并安装MongoDB的最新稳定版本:

<span class="pln">sudo dnf update
sudo yum install mongodb</span><span class="pun">-</span><span class="pln">org</span>

安装完成后,我们需要启动MongoDB服务器才能开始运行。我们使用以下命令执行此操作:

<span class="pln">sudo systemctl start mongod
sudo systemctl enable mongod</span>

第5步。在 Fedora 37 上安装 RustDesk。

默认情况下,RustDesk 在 Fedora 37 默认存储库中不可用。现在打开系统上的终端并运行以下命令将 Graylog 存储库添加到您的系统中:

<span class="pln">sudo rpm </span><span class="pun">-</span><span class="typ">Uvh</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//packages.graylog2.org/repo/packages/graylog-5.0-repository_latest.rpm</span>

添加存储库后,运行以下命令以在系统上安装 Graylog

<span class="pln">sudo dnf install graylog</span><span class="pun">-</span><span class="pln">server</span>

安装完成后,使用以下命令启动 Graylog 服务:

<span class="pln">sudo systemctl start graylog</span><span class="pun">-</span><span class="pln">server
sudo systemctl enable graylog</span><span class="pun">-</span><span class="pln">server</span>

第 6 步。灰日志的配置。

Fedora 37安装 Graylog 后,我们需要配置它以开始处理日志。使用以下命令打开位于 的 Graylog 配置文件:/etc/graylog/server/server.conf

<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">graylog</span><span class="pun">/</span><span class="pln">server</span><span class="pun">/</span><span class="pln">server</span><span class="pun">.</span><span class="pln">conf</span>

在配置文件中找到以下行并设置系统的 IP 地址:

<span class="pln">rest_listen_uri </span><span class="pun">=</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//127.0.0.1:9000/api/</span>

将其更改为:

<span class="pln">rest_listen_uri </span><span class="pun">=</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//<your-IP-address>:9000/api/</span>

在配置文件中找到以下行并取消注释:

<span class="com">#web_listen_uri = http://127.0.0.1:9000/</span>

将其更改为:

<span class="pln">web_listen_uri </span><span class="pun">=</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//<your-IP-address>:9000/api/</span>

此外,添加 password_secret 和 root_password sha2,因为这些是强制性的,没有它们,Graylog 将无法启动。要创建 ,请运行以下命令:root_password_sha2

<span class="pln">echo </span><span class="pun">-</span><span class="pln">n </span><span class="str">"Enter Password: "</span> <span class="pun">&&</span><span class="pln"> head </span><span class="pun">-</span><span class="lit">1</span> <span class="pun"><</span><span class="str">/dev/</span><span class="pln">stdin </span><span class="pun">|</span><span class="pln"> tr </span><span class="pun">-</span><span class="pln">d </span><span class="str">'\n'</span> <span class="pun">|</span><span class="pln"> sha256sum </span><span class="pun">|</span><span class="pln"> cut </span><span class="pun">-</span><span class="pln">d</span><span class="str">" "</span> <span class="pun">-</span><span class="pln">f1</span>

接下来,生成一个:password_secret

<span class="pln">< /dev/urandom tr -dc A-Z-a-z-0-9 | head -c${1:-96};echo;</span>

最后,使用以下命令重新启动 Graylog 服务:

<span class="pln">sudo systemctl restart graylog</span><span class="pun">-</span><span class="pln">server</span>

步骤 7.配置防火墙。

我们需要将防火墙配置为允许 Graylog 服务器的流量通过端口 9000:

<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">port</span><span class="pun">=</span><span class="lit">9000</span><span class="pun">/</span><span class="pln">tcp </span><span class="pun">--</span><span class="pln">permanent
sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>

第8步。访问格雷日志网页界面。

成功安装后,打开您的网络浏览器并使用 URL 访问 WordPress CMS .您将被重定向到以下页面:http://your-IP-address:9000

如何在 Fedora 37 上安装 Graylog

感谢您使用本教程在您的 Fedora 37 系统上安装 Graylog。如需其他帮助或有用信息,我们建议您查看 Graylog 官方网站


Edge插件网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在 Fedora 37 上安装 Graylog
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址