Linux安装、配置及启动JBOSS

一、JDK和JBOSS下载
jdk:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
jboss:
https://developers.redhat.com/products/eap/download/
红帽官方下载JBOSS EAP可能需要先注册红帽账号才能下载,版本比较新。如果安装旧版的JBOSS AS可以在以下地址下载:
http://jbossas.jboss.org/downloads

二、配置JDK

tar -xvf jdk-8u201-linux-x64.tar.gz 
mv jdk1.8.0_201 /usr/local/java
vim /etc/profile
//在后面追加
export JAVA_HOME=/usr/local/java
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib
export JAVA_PATH=$JAVA_HOME/bin:$JRE_HOME/bin
export PATH=$PATH:$JAVA_PATH

//使配置立即生效
source /etc/profile
//测试
java -version

三、安装、配置及启动JBOSS

 tar -xvf jboss-eap-7.2.0.Beta.zip 
 mv jboss-eap-7.2 /usr/local/jboss

1、配置 JBOSS环境变量:

vim /etc/profile 
//在后面追加
export JBOSS_HOME=/usr/local/jboss
export CLASSPATH=.:$CLASSPATH:$JBOSS_HOME/lib
export PATH=$PATH:$JBOSS_HOME/bin

//使配置立即生效
source /etc/profile

2、启动JBOSS

cd /usr/local/jboss/bin
./standalone.sh &
[root@localhost bin]# =========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /usr/local/jboss

  JAVA: /usr/local/java/bin/java

  JAVA_OPTS:  -server -verbose:gc -Xloggc:"/usr/local/jboss/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -Xms1303m -Xmx1303m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

02:10:13,507 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.5.Final-redhat-1
02:10:14,834 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.2.Final-redhat-1
02:10:14,880 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final-redhat-1
02:10:15,372 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: JBoss EAP 7.2.0.Beta (WildFly Core 5.0.5.Final-redhat-00001) starting
02:10:25,169 INFO  [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/core-service=management/management-interface=http-interface' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
02:10:25,310 INFO  [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 12) WFLYCTL0028: Attribute 'security-realm' in the resource at address '/subsystem=undertow/server=default-server/https-listener=https' is deprecated, and may be removed in a future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
02:10:25,333 INFO  [org.wildfly.security] (ServerService Thread Pool -- 21) ELY00001: WildFly Elytron version 1.3.3.Final-redhat-1
02:10:25,639 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
02:10:25,734 INFO  [org.xnio] (MSC service thread 1-1) XNIO version 3.6.3.Final-redhat-1
02:10:25,751 INFO  [org.xnio.nio] (MSC service thread 1-1) XNIO NIO Implementation Version 3.6.3.Final-redhat-1
02:10:26,544 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 60) WFLYSEC0002: Activating Security Subsystem
02:10:26,552 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 64) WFLYWS0002: Activating WebServices Extension
02:10:26,102 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 62) WFLYTX0013: The node-identifier attribute on the /subsystem=transactions is set to the default value. This is a danger for environments running multiple servers. Please make sure the attribute value is unique.
02:10:26,591 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 45) WFLYCLINF0001: Activating Infinispan subsystem.
02:10:26,787 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 54) WFLYNAM0001: Activating Naming Subsystem
02:10:27,300 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 52) WFLYJSF0007: Activated the following JSF Implementations: [main]
02:10:28,477 INFO  [org.jboss.as.ee] (ServerService Thread Pool -- 41) WFLYEE0119: The system property 'ee8.preview.mode' is NOT set to 'true'. For provided EE 8 APIs where the EE 8 version of the API differs from what is supported in EE 7, the EE 7 variant of the API will be used. Support for this setting will be removed once all EE 8 APIs are provided and certified.
02:10:29,995 INFO  [org.jboss.as.security] (MSC service thread 1-2) WFLYSEC0001: Current PicketBox version=5.0.3.Final-redhat-2
02:10:31,183 INFO  [org.jboss.as.jaxrs] (ServerService Thread Pool -- 47) WFLYRS0016: RESTEasy version 3.5.1.Final-redhat-1
02:10:35,869 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0003: Undertow 2.0.9.Final-redhat-1 starting
02:10:36,673 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 38) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.4)
02:10:39,532 INFO  [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.9.Final-redhat-1)
02:10:39,725 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 46) WFLYIO001: Worker 'default' has auto-configured to 2 core threads with 16 task threads based on your 1 available processors
02:10:42,276 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 63) WFLYUT0014: Creating file handler for path '/usr/local/jboss/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
02:10:42,969 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = h2
02:10:43,851 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 5.0.7.Final-redhat-1
02:10:44,224 INFO  [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Starting Naming Service
02:10:55,406 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 16 (per class), which is derived from thread worker pool sizing.
02:10:55,439 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 4 (per class), which is derived from the number of CPUs on this host.
02:10:56,069 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
02:10:57,379 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0012: Started server default-server.
02:10:58,493 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0018: Host default-host starting
02:10:58,697 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
02:10:59,037 INFO  [org.jboss.as.patching] (MSC service thread 1-2) WFLYPAT0050: JBoss EAP cumulative patch ID is: base, one-off patches include: none
02:10:59,124 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0493: EJB subsystem suspension complete
02:10:59,907 WARN  [org.jboss.as.domain.management.security] (MSC service thread 1-1) WFLYDM0111: Keystore /usr/local/jboss/standalone/configuration/application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
02:11:01,673 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) WFLYDS0013: Started FileSystemDeploymentService for directory /usr/local/jboss/standalone/deployments
02:11:02,135 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
02:11:02,706 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
02:11:03,451 INFO  [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.2.1.Final-redhat-1 (Apache CXF 3.2.5.redhat-00001) 
02:11:05,073 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
02:11:05,105 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
02:11:05,105 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
02:11:05,107 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.2.0.Beta (WildFly Core 5.0.5.Final-redhat-00001) started in 53270ms - Started 290 of 511 services (308 services are lazy, passive or on-demand)

3、测试是否启动正常:
ss -an |grep 8080
ss -an|grep 9990
curl http://127.0.0.1:8080

4、到这一步,虽然JBoss已经启动,但是如果从本机127.0.0.1以外的地址去访问JBoss是访问不了的,JBoss默认只允许本机访问,若要从任何地方都可以访问,需要修改配置文件中JBoss的监听地址:

cd /usr/local/jboss/standalone/configuration
vim standalone.xml

找到interface name=“public”

修改接口绑定地址, 设置可通过本机所有IP都可访问

<inet-addressvalue="${jboss.bind.address:127.0.0.1}"/>

修改为:

 <inet-addressvalue="${jboss.bind.address:0.0.0.0}"/>

找到interface name=“management”

<interfacename=“management”>

<inet-addressvalue="${jboss.bind.address.management:127.0.0.1}"/>

修改为

<interfacename=“management”>

<inet-addressvalue="${jboss.bind.address.management:0.0.0.0}"/>

5、关闭JBoss服务并重新启动
kill -9 “pid”
重新启动JBoss,并测试从其他地址访问(注意可能要提前关闭firewalld,或者设置iptables):

ss -an|grep 8080
ss -an|grep 9990
curl "JBOSS的服务IP”:8080

通过浏览器打开:
http://"JBOSS的服务IP”:8080

四、添加Jboss用户并测试访问

cd /usr/local/jboss/bin
./add-user.sh

通过浏览器打开:
http://"JBOSS的服务IP”:9990
用刚才添加的JBoss用户登录
在这里插入图片描述在这里插入图片描述

参考文档:
https://blog.csdn.net/yabingshi_tech/article/details/51558026
http://www.cnblogs.com/mchina/archive/2012/05/18/2507684.html

猜你喜欢

转载自blog.csdn.net/szuwangjl/article/details/86561982