标签:
一、软件准备
jboss-5.1.0.GA.zip
Centos 6.4 64位
java 1.7.0_25
二、软件部署
1)添加环境变量
vim /etc/profile
export JBOSS_HOME=/software/jboss-5.1.0.GA export JAVA_HOME=/software/jdk1.7.0_25 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$JBOSS_HOME/bin:$PATH
2)配置Jboss
注:$JBOSS_HOME/server下的目录结构,启动指定一个进行启动即可,默认是启动default
本例中使用web目录进行部署项目,更改jboss启动端口
cd $JBOSS_HOME/server/web/deploy && vim jbossweb.sar/server.xml 12 <Connector protocol="HTTP/1.1" port="8080" address="0.0.0.0" #更改访问地址 connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>#添加UTF-8编码 68 <Host name="localhost"> #此处可进行添加项目访问路径等
更改jboss部署目录
#cd $JBOSS_HOME/server/default/conf/bootstrap && vim profile.xml <property name="applicationURIs"> <list elementClass="java.net.URI"> <value>${jboss.server.home.url}deploy</value> #添加如下内容即添加了一个部署目录 <value>file:/home/jboss/test</value>注:绝对路径前以file:开始 </list> </property>
将war包放到$JBOSS_HOME/server/web/deploy/ 启动服务即可
另附脚本:
#!/bin/bash #This For Linux Jboss JBOSS_PID=${JBOSS_PID:-"`ps aux | grep java | grep "web" | awk ‘{print $2}‘`"} JBOSS_HOME=${JBOSS_HOME:-"/software/jboss-5.1.0.GA"} JAVAPTH=${JAVAPTH:-"/software/jdk1.7.0_25/bin"} #JBOSS config "all" "default" "minimal" "standard" "web" JBOSS_CONF=${JBOSS_CONF:-"web"} JBOSS_USER=${JBOSS_USER:-"jboss"} start () { echo "start jboss" $JBOSS_HOME/bin/run.sh -c $JBOSS_CONF 2>&1 > /home/jboss/jboss_start.log & if [[ $? -eq 0 ]]; then echo "JBOSS Start success" else echo "JBOSS Start Fail" fi } stop () { echo "stop JBOSS" kill -9 $JBOSS_PID if [[ $? -eq 0 ]];then echo "JBOSS STOP success" else echo "JBOSS STOP FAIL" fi } case $1 in start) start; ;; stop) stop; ;; restart) stop; sleep 10 start; ;; *) echo "Usage:$0(start|stop|restart)" exit 1 esac
至此基础的jboss-5.1.0 GA配置完毕
标签:
原文地址:http://my.oschina.net/u/2420218/blog/481347