jboss是什么?
    Jboss是一个基J2EE的开放源代码的应用服务器。jboss的最后一个版本为JBoss AS 7,在这之后JBoss社区已将它变更为WildFly项目,作为JBoss的新版本。WildFly官方网站:http://wildfly.org/。
    Jboss的下载地址:http://jbossas.jboss.org/downloads/
    Jboss服务的运行需要java环境,因此首先安装jdk:


安装jdk

[root@host1 ~]# sh hm-jdk-install.sh  # jdk安装脚本
#!/bin/bash
# Author: hm  Email: [email protected]
jdk_v=jdk1.7.0_79
jdk_s=jdk-7u79-linux-x64.gz
jdk_home=/usr/local/jdk

if [ ! -d ${jdk_home} ];then
    echo
    echo "-----Installing ${jdk_v}-----"
    echo
    cd /usr/local/src
    if [ ! -e ${jdk_s} ];then
        echo "[${jdk_s}] source package no find! Please put it in /usr/local/src/ ..."
    else
        tar -zxf ${jdk_s} -C /usr/local && cd /usr/local && ln -s ${jdk_v} jdk
        echo -e 'export JAVA_HOME=/usr/local/jdk\nexport PATH=$JAVA_HOME/bin:$PATH' > /etc/profile.d/jdk.sh
        source /etc/profile.d/jdk.sh && java -version
        echo "------------------------"
        echo
    fi
else
    source /etc/profile.d/jdk.sh && java -version
fi


安装jboss-as-7.1.1.Final.tar.gz

[root@host1 ~]# tar -zxf jboss-as-7.1.1.Final.tar.gz -C /usr/local/
[root@host1 ~]# cd /usr/local/
[root@host1 local]# ln -s jboss-as-7.1.1.Final jboss

设置jboss环境变量

[root@host1 ~]# vim /etc/profile.d/jboss.sh
export JBOSS_HOME=/usr/local/jboss
export PATH=$JBOSS_HOME/bin:$PATH
[root@host1 ~]# source /etc/profile.d/jboss.sh

修改默认监听地址

[root@host1 ~]# vim /usr/local/jboss/standalone/configuration/standalone.xml
        
            
        
# 将"public"下的127.0.0.1修改为本机IP地址,也可以修改为0.0.0.0,表示监听所有的地址。
# 这个地址默认监听的是8080端口

启动jboss

[root@host1 ~]# nohup standalone.sh &   # 以后台的形式启动jboss

# 查看监听端口和进程
[root@host1 ~]# netstat -tuanlp | grep java
tcp        0      0 10.0.0.31:4447              0.0.0.0:*                   LISTEN      4032/java           
tcp        0      0 127.0.0.1:9990              0.0.0.0:*                   LISTEN      4032/java           
tcp        0      0 127.0.0.1:9999              0.0.0.0:*                   LISTEN      4032/java           
tcp        0      0 10.0.0.31:8080              0.0.0.0:*                   LISTEN      4032/java
[root@host1 ~]# ps -elf | grep java
0 S root       4032   3979 15  80   0 - 801821 futex_ 15:22 pts/3   00:00:11 /usr/local/jdk/bin/java -D[Standalone] -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 -Dorg.jboss.boot.log.file=/usr/local/jboss/standalone/log/boot.log -Dlogging.configuration=file:/usr/local/jboss/standalone/configuration/logging.properties -jar /usr/local/jboss/jboss-modules.jar -mp /usr/local/jboss/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/usr/local/jboss
0 S root       4128   2131  0  80   0 - 25826 pipe_w 15:23 pts/3    00:00:00 grep java


浏览器访问jboss

Linux下jboss7的安装部署_第1张图片


jboss的调试日志

[root@host1 log]# pwd
/usr/local/jboss/standalone/log
[root@host1 log]# tail server.log
15:22:12,960 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
15:22:13,116 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
15:22:13,280 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-7) JBoss Web Services - Stack CXF Server 4.0.2.GA
15:22:13,422 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-4) Starting Coyote HTTP/1.1 on http--10.0.0.31-8080
15:22:14,014 INFO  [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /10.0.0.31:4447
15:22:14,015 INFO  [org.jboss.as.remoting] (MSC service thread 1-7) JBAS017100: Listening on /127.0.0.1:9999
15:22:14,019 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) JBAS015012: Started FileSystemDeploymentService for directory /usr/local/jboss/standalone/deployments
15:22:14,255 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
15:22:14,319 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
15:22:14,321 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 3557ms - Started 133 of 208 services (74 services are passive or on-demand)


jboss项目部署

将war包上传到/usr/local/jboss/standalone/deployments/目录下


jboss的配置文件/usr/local/jboss/bin/standalone.conf
该文件可以修改jboss启动内存相关信息等