WildFly是一个灵活,轻量级的开源应用程序服务器,是用Java编写的。它也被称为JBoss AS或JBoss EAP,最初由JBoss社区开发,现在由Red Hat维护。WildFly 用于构建和部署基于 Java 的应用程序,例如网站、Web 应用程序和企业应用程序。
在 Rocky Linux 9 上安装 WildFly
第 1 步。第一步是将系统更新到最新版本的软件包列表。为此,请运行以下命令:
<span class="pln">sudo dnf check</span><span class="pun">-</span><span class="pln">update sudo dnf update</span>
第 2 步。安装爪哇。
WildFly需要在系统上安装Java。我们将安装 OpenJDK 11,它在默认的 Rocky Linux 9 存储库中可用。要安装 Java,请运行以下命令:
<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><span class="pun">-</span><span class="pln">devel</span>
验证 Java 版本:
<span class="pln">java </span><span class="pun">-</span><span class="pln">version</span>
第 3 步。在 Rocky Linux 9 上安装 WildFly。
默认情况下,WildFly 在 Rocky Linux 9 基础存储库中不可用。现在我们从官方页面下载最新版本的 WildFly:
<span class="pln">wget https</span><span class="pun">:</span><span class="com">//github.com/wildfly/wildfly/releases/download/27.0.1.Final/wildfly-27.0.1.Final.zip</span>
接下来,使用以下命令提取下载的文件:
<span class="pln">sudo tar </span><span class="pun">-</span><span class="pln">xvf wildfly</span><span class="pun">-</span><span class="lit">27.0</span><span class="pun">.</span><span class="lit">1.Final</span><span class="pun">.</span><span class="pln">zip</span>
第 4 步。创建一个野蝇用户。
运行以下命令为 WildFly 创建新的系统用户:
<span class="pln">sudo useradd </span><span class="pun">-</span><span class="pln">r </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nologin wildfly</span>
使用以下命令设置提取的 WildFly 目录的权限:
<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R wildfly</span><span class="pun">:</span><span class="pln">wildfly </span><span class="pun">/</span><span class="pln">opt</span><span class="pun">/</span><span class="pln">wildfly</span><span class="pun">-</span><span class="lit">27.0</span><span class="pun">.</span><span class="lit">1.Final</span><span class="pun">/</span>
第5步。为 WildFly 创建一个系统服务文件。
运行以下命令以创建新的服务文件:systemd
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">systemd</span><span class="pun">/</span><span class="pln">system</span><span class="pun">/</span><span class="pln">wildfly</span><span class="pun">.</span><span class="pln">service</span>
添加以下文件:
<span class="pun">[</span><span class="typ">Unit</span><span class="pun">]</span> <span class="typ">Description</span><span class="pun">=</span><span class="typ">WildFly</span><span class="pln"> application server </span><span class="typ">After</span><span class="pun">=</span><span class="pln">syslog</span><span class="pun">.</span><span class="pln">target network</span><span class="pun">.</span><span class="pln">target </span><span class="pun">[</span><span class="typ">Service</span><span class="pun">]</span> <span class="typ">Type</span><span class="pun">=</span><span class="pln">simple </span><span class="typ">User</span><span class="pun">=</span><span class="pln">wildfly </span><span class="typ">Group</span><span class="pun">=</span><span class="pln">wildfly </span><span class="typ">ExecStart</span><span class="pun">=</span><span class="str">/opt/</span><span class="pln">wildfly</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">standalone</span><span class="pun">.</span><span class="pln">sh </span><span class="pun">-</span><span class="pln">b</span><span class="pun">=</span><span class="lit">0.0</span><span class="pun">.</span><span class="lit">0.0</span> <span class="typ">ExecStop</span><span class="pun">=</span><span class="str">/opt/</span><span class="pln">wildfly</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">jboss</span><span class="pun">-</span><span class="pln">cli</span><span class="pun">.</span><span class="pln">sh </span><span class="pun">--</span><span class="pln">connect command</span><span class="pun">=:</span><span class="pln">shutdown </span><span class="typ">TimeoutStartSec</span><span class="pun">=</span><span class="lit">300</span> <span class="typ">TimeoutStopSec</span><span class="pun">=</span><span class="lit">300</span> <span class="typ">Restart</span><span class="pun">=</span><span class="pln">always </span><span class="typ">RestartSec</span><span class="pun">=</span><span class="lit">10</span> <span class="pun">[</span><span class="typ">Install</span><span class="pun">]</span> <span class="typ">WantedBy</span><span class="pun">=</span><span class="pln">multi</span><span class="pun">-</span><span class="pln">user</span><span class="pun">.</span><span class="pln">target</span>
保存并关闭文件,然后使用以下命令启动 WildFly 服务:
<span class="pln">sudo systemctl enable wildfly sudo systemctl start wildfly</span>
若要检查服务是否已成功启动,请使用以下命令:
<span class="pln">sudo systemctl status wildfly</span>
第 6 步。配置防火墙。
现在允许 WildFly 管理控制台端口通过防火墙:
<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">permanent </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">9990</span><span class="pun">/</span><span class="pln">tcp sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>
步骤 7.访问野蝇网页界面。
成功安装后,打开您的网络浏览器并使用 URL 访问 WildFly。您将被重定向到以下页面:http://your-IP-address:9990
默认用户名和密码均为 。admin
感谢您使用本教程在 Rocky Linux 9 系统上安装 WildFly。如需其他帮助或有用信息,我们建议您查看 WildFly 官方网站。