Jboss EAP 7 Installation using zip
目录:
WildFly(以前称为JBoss)是用Java编写的跨平台开源应用程序运行时,可帮助您构建出色的应用程序。 WildFly灵活,轻便,并且基于可根据需要添加或删除的可插拔子系统。
在本教程中,我们将引导您完成在Debian 9上安装WildFly应用程序服务器所需的步骤。
先决条件
您登录后的用户必须具有sudo特权才能安装软件包。
安装Java OpenJDK
WildFly需要安装Java。 我们将安装OpenJDK,这是Debian 9中的默认Java开发和运行时:
sudo apt update
sudo apt install default-jdk
建立使用者
使用主目录
/opt/wildfly
创建一个名为
wildfly
的新系统用户和组,该用户和组将运行WildFly服务:
sudo groupadd -r wildfly
sudo useradd -r -g wildfly -d /opt/wildfly -s /sbin/nologin wildfly
安装WildFly
在撰写本文时,WildFly的最新版本是
16.0.0
。 在继续下一步之前,您应该检查下载页面是否有新版本。 如果有新版本,
WILDFLY_VERSION
在下面的命令中替换
WILDFLY_VERSION
变量。
使用以下
wget
命令在
/tmp
目录中下载WildFly存档:
WILDFLY_VERSION=16.0.0.Final
wget https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz -P /tmp
下载完成后,解压缩tar.gz文件并将其移至
/opt
目录:
sudo tar xf /tmp/wildfly-$WILDFLY_VERSION.tar.gz -C /opt/
创建一个符号链接
wildfly
,它将指向WildFly安装目录:
sudo ln -s /opt/wildfly-$WILDFLY_VERSION /opt/wildfly
WildFly以需要访问WildFly安装目录的
wildfly
用户身份运行。 将目录所有权更改为user和group
wildfly
:
sudo chown -RH wildfly: /opt/wildfly
配置Systemd
WildFly软件包包括将WildFly作为服务运行所需的文件。
首先创建一个目录,其中将保存WildFly配置文件:
sudo mkdir -p /etc/wildfly
将配置文件复制到
/etc/wildfly
目录:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.conf /etc/wildfly/
该文件允许您指定WildFly模式和绑定地址。 默认情况下,WildFly将以独立模式运行,并将在所有接口上侦听。 根据需要编辑文件。
/etc/wildfly/wildfly.conf
# The configuration you want to run WILDFLY_CONFIG=standalone.xml # The mode you want to run WILDFLY_MODE=standalone # The address to bind to WILDFLY_BIND=0.0.0.0
接下来,将WildFly
launch.sh
脚本复制到
/opt/wildfly/bin/
目录:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/launch.sh /opt/wildfly/bin/
bin
目录中的脚本需要具有可执行标志:
sudo sh -c 'chmod +x /opt/wildfly/bin/*.sh'
最后一步是将名为systemd的单元文件复制到
/etc/systemd/system/
目录:
sudo cp /opt/wildfly/docs/contrib/scripts/systemd/wildfly.service /etc/systemd/system/
重新加载systemd Manager配置:
sudo systemctl daemon-reload
启动并启用WildFly服务以在启动时自动启动:
sudo systemctl start wildfly
sudo systemctl enable wildfly
使用以下命令检查服务状态:
sudo systemctl status wildfly
* wildfly.service - The WildFly Application Server Loaded: loaded (/etc/systemd/system/wildfly.service; disabled; vendor preset: enabled) Active: active (running) since Sun 2019-02-17 04:59:39 PST; 2s ago Main PID: 10005 (launch.sh) Tasks: 62 (limit: 2319) CGroup: /system.slice/wildfly.service
调整防火墙
如果服务器受防火墙保护,并且您想从本地网络外部访问WildFly接口,则需要打开端口
8080
。
要允许端口
8080
上的流量输入以下命令:
sudo ufw allow 8080/tcp
在生产环境中运行WildFly应用程序时,很可能您将具有负载平衡器或反向代理,并且最佳做法是将对端口8080的访问限制为仅对内部网络的访问。
配置WildFly身份验证
现在已安装并运行WildFly,下一步是创建一个用户,该用户将能够使用管理控制台或使用CLI进行远程连接。
要添加新用户,请使用位于WildFly的bin目录中的
add-user.sh
脚本:
sudo /opt/wildfly/bin/add-user.sh
系统将询问您要添加哪种类型的用户:
What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a):
选择
a
然后
Enter
:
接下来,脚本将提示您输入新用户的详细信息:
Enter the details of the new user to add. Using realm 'ManagementRealm' as discovered from the existing property files. Username: linuxize Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file. - The password should be different from the username - The password should not be one of the following restricted values {root, admin, administrator} - The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s) Password: Re-enter Password: What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none): About to add user 'linuxize' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'linuxize' to file '/opt/wildfly-16.0.0.Final/standalone/configuration/mgmt-users.properties' Added user 'linuxize' to file '/opt/wildfly-16.0.0.Final/domain/configuration/mgmt-users.properties' Added user 'linuxize' with groups to file '/opt/wildfly-16.0.0.Final/standalone/configuration/mgmt-groups.properties' Added user 'linuxize' with groups to file '/opt/wildfly-16.0.0.Final/domain/configuration/mgmt-groups.properties' Is this new user going to be used for one AS process to connect to another AS process? eg for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls. yes/no? yes To represent the user add the following to the server-identities definition
新用户将被添加到用于身份验证的属性文件中。
测试WildFly安装
要访问默认的WildFly页面,请打开浏览器并输入:
http://:8080
http://:8080
假设安装成功,将出现类似以下的屏幕:


打开
wildfly.conf
并在文件末尾附加
WILDFLY_CONSOLE_BIND=0.0.0.0
。
# The configuration you want to run WILDFLY_CONFIG=standalone.xml # The mode you want to run WILDFLY_MODE=standalone # The address to bind to WILDFLY_BIND=0.0.0.0 # The address console to bind to WILDFLY_CONSOLE_BIND=0.0.0.0
打开
launch.sh
并编辑突出显示的行:
#!/bin/bash if; then WILDFLY_HOME="/opt/wildfly" fi if]; then $WILDFLY_HOME/bin/domain.sh -c $2 -b $3 -bmanagement $4 else $WILDFLY_HOME/bin/standalone.sh -c $2 -b $3 -bmanagement $4 fi
重新启动服务以使更改生效:
sudo systemctl restart wildfly
打开
wildfly.service
并编辑突出显示的行:
Description=The WildFly Application Server After=syslog.target network.target Before=httpd.service Environment=LAUNCH_JBOSS_IN_BACKGROUND=1 EnvironmentFile=-/etc/wildfly/wildfly.conf User=wildfly LimitNOFILE=102642 PIDFile=/var/run/wildfly/wildfly.pid ExecStart=/opt/wildfly/bin/launch.sh $WILDFLY_MODE $WILDFLY_CONFIG $WILDFLY_BIND $WILDFLY_CONSOLE_BIND StandardOutput=null WantedBy=multi-user.target
创建
/var/run/wildfly
目录并设置正确的权限:
sudo mkdir /var/run/wildfly/
sudo chown wildfly: /var/run/wildfly/
重新加载systemd Manager配置:
sudo systemctl daemon-reload
通过运行以下命令重新启动WildFly服务:
sudo systemctl restart wildfly
假设您的防火墙未阻止端口
9990
,则您应该能够通过以下网址访问WildFly管理控制台
http://:9990/console
http://:9990/console
。
结论
您已经在Debian 9服务器上成功安装了WildFly。 您应该访问官方的WildFly文档并了解有关WildFly功能的更多信息。
Java Wildfly Debian如何在Debian 9上添加和删除用户
知道如何添加和删除用户是Linux用户应该知道的基本技能之一。 在本教程中,我们将向您展示如何在Debian 9上添加和删除用户。
如何在Debian 9上添加交换空间
交换是物理RAM内存已满时使用的磁盘空间。 本教程概述了在Debian 9系统上添加交换文件所必需的步骤。
如何在Debian 10 Linux上添加交换空间
交换是物理内存量已满时使用的磁盘空间。 本教程将指导您完成在Debian 10 Buster上添加交换文件的步骤。







