环境:Redhat6.5
jboss安装包:jboss-as-7.1.1.Final.zip
jdk安装包:jdk-7u45-linux-x64.rpm
安装jdk
rpm -ivh jdk-7u45-linux-x64.rpm
使用rpm安装jdk会只自动安装到 /usr/java/目录下
在 /etc/profile 文件中添加一下信息
export JAVA_HOME=/usr/java/jdk1.7.0_45
export JRE_HOME=/usr/java/jdk1.7.0_45/jre
export PATH=$PATH:/usr/java/jdk1.7.0_45/bin
export CLASSPATH=./:/usr/java/jdk1.7.0_45/lib:/usr/java/jdk1.7.0_45/jre/lib
加载文件并查看jdk是否安装成功
[root@localhost ~]# source /etc/profile
[root@localhost ~]# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
安装JBOSS
直接解压到安装目录并在/etc/profile文件中添加
[root@localhost ~]unzip jboss-as-7.1.1.Final.zip -d /usr/
export JBOSS_HOME=/usr/jboss-as-7.1.1.Final #JBOSS的安装目录
export PATH=$PATH:$JBOSS_HOME/bin #JBOSS的bin目录
启动JBOSS
[root@localhost ~]# /usr/jboss-as-7.1.1.Final/bin/standalone.sh
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /usr/jboss-as-7.1.1.Final
JAVA: /usr/java/jdk1.7.0_45/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml
=========================================================================
03:39:12,095 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
03:39:12,766 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
03:39:12,828 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
03:39:14,930 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
03:39:14,943 INFO [org.xnio] XNIO Version 3.0.3.GA
03:39:14,974 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
03:39:15,001 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
03:39:15,036 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
03:39:15,044 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
03:39:15,091 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
03:39:15,144 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
03:39:15,152 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
03:39:15,174 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
03:39:15,201 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
03:39:15,291 INFO [org.jboss.as.security] (MSC service thread 1-1) JBAS013100: Current PicketBox version=4.0.7.Final
03:39:15,341 INFO [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
03:39:15,384 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
03:39:15,484 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
03:39:15,734 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
03:39:16,140 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.2.GA
03:39:16,313 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
03:39:16,702 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory /usr/jboss-as-7.1.1.Final/standalone/deployments
03:39:16,735 INFO [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on /127.0.0.1:9999
03:39:16,754 INFO [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on /127.0.0.1:4447
03:39:16,873 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
03:39:16,944 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
03:39:16,944 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 5470ms - Started 133 of 208 services (74 services are passive or on-demand)
到这里表示启动成功,但是不会返回到当前目录,而是直接停在这里。如果ctrl+c停止的话,jboss也就被强制停掉。可以用下面这条命令执行启动脚本,让进程在后台运行
[root@localhost usr]# nohup /usr/jboss-as-7.1.1.Final/bin/standalone.sh &
[3] 3339
[root@localhost usr]# nohup: ignoring input and appending output to `nohup.out'
^C
[root@localhost usr]#
使用虚拟机自带的firefox浏览器在浏览器输入localhost:8080可直接访问
如果你使用电脑上的浏览器 需要将虚拟机网卡设置为桥接,并修改配置文件
文件的第280行,默认IP是127.0.0.1修改为虚拟机的实际IP
如下:
[root@localhost ~]# vim /usr/jboss-as-7.1.1.Final/standalone/configuration/standalone.xml
==》
我是在虚拟机安装并且iptables已被关闭所以不存在端口问题,如果iptables是在开启状态需要开启对应的端口8080才能访问
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
执行脚本添加用户:
[root@localhost bin]# ./add-user.sh
*********
*********
Username : tom
Password :
Re-enter Password :
About to add user 'tom' for realm 'ManagementRealm'
Is this correct yes/no? y
Added user 'tom' to file '/usr/jboss-as-7.1.1.Final/standalone/configuration/mgmt-users.properties'
Added user 'tom' to file '/usr/jboss-as-7.1.1.Final/domain/configuration/mgmt-users.properties'
打开浏览器输入: 127.0.0.1:9990
输入刚才新建的账户名密码可以登录
在这里遇到一个问题始终没能解决
虚拟机自带的浏览器输入:localhost:9990 可以登录,输入IP却不能登录
修改/usr/local/jboss/standalone/configuration/standalone.xml
修改为
IP地址修改为本机IP后重启JBOSS仍然无法访问9990端口
在浏览器输入IP:9990/console 也不可以
我甚至尝试把配置文件中的所有127.0.0.1全部改成本机IP地址重启服务也都不可以访问9990
一个朋友在云主机上安装该环境遇到和我同样的问题,把配置文件127.0.0.1改成云主机IP后甚至无法启动JBOSS,但是把127.0.0.1改成0.0.0.0后重启JBOSS 在本地浏览器输入云主机IP:9990可以正常登陆。
搞了一下午也没能解决该问题。。。哪位大神看到帮我解决一下,不胜感激!!!