当前位置: 首页 > 工具软件 > JBoss Build > 使用案例 >

jboss linux环境部署,linux下部署jboss

孔厉刚
2023-12-01

操作系统Linux5(64bit)

(本文档是32位系统测试,生产环境下载64位jdk)程序都下载到/usr/local目录

撰写人:hx10

日期:2010/6/23 hangzhou

第一步、安装

#chmod +x jdk-6u20-linux-i586.bin

#./ jdk-6u20-linux-i586.bin

#unzip jboss-4.2.3.GA.zip

linux系统下普通用户不能创建1024以下的端口,所以使用root权限运行jboss

第二步、修改环境变量

#vim /etc/profile

JAVA_HOME=/usr/local/jdk1.6.0_20

JRE_HOME=/usr/local/jdk1.6.0_20/jre

PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export JAVA_HOME JRE_HOME PATH CLASSPATH

#source /etc/profile

#java -version

java version "1.6.0_20"

Java(TM) SE Runtime Environment (build 1.6.0_20-b02)

Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

修改系统打开文件限制

# vim /etc/security/limits.conf

*softnofile204800

*hardnofile204800

# vim /etc/pam.d/login

session    required     /lib/security/pam_limits.so

关闭不需要的系统服务

chkconfig bluetooth off

chkconfig firstboot off

chkconfig cups off

chkconfig ip6tables off

chkconfig iptables off

chkconfig isdn off

chkconfig kudzu off

chkconfig sendmail off

chkconfig smartd off

chkconfig autofs off

service bluetooth stop

service firstboot stop

service cups stop

service ip6tables stop

service iptables stop

service isdn stop

service kudzu stop

service sendmail stop

service smartd stop

service autofs stop

第三步、修改jboss配置

#cd /usr/local/jboss-4.2.3.GA/bin/

#vim run.sh

在第四行前面加一个nohup

while true; do

if [ "x$LAUNCH_JBOSS_IN_BACKGROUND" = "x" ]; then

# Execute the JVM in the foreground

nohup"$JAVA" $JAVA_OPTS \

然后在最后一行加上&

exit $JBOSS_STATUS

fi

done &

同时在最开头加上一句

export LANG=zh_CN.GB18030

DIRNAME=`dirname $0`

PROGNAME=`basename $0`

GREP="grep"

#vim run.conf

if [ "x$JAVA_OPTS" = "x" ]; then

JAVA_OPTS="-Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

-XX:+UseParallelGC -XX:+UseParallelOldGC"

fi

这里最大内存建议为物理内存的3/4,最小内存为最大内存的1/4

添加两个参数-XX:+UseParallelGC -XX:+UseParallelOldGC这两个让服务并行回收内存空间。

#vim /usr/local/jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer/server.xml

把端口改成80,地址改成0.0.0.0,同时开启gzip压缩,添加最后一段代码

maxThreads="250" maxHttpHeaderSize="8192"

emptySessionPath="true" protocol="HTTP/1.1"

enableLookups="false" redirectPort="8443" acceptCount="100"

connectionTimeout="20000" disableUploadTimeout="true"

compression="on"

compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/xhtml+xml,application/x

-javascript,application/javascript,text/xhtml"

/>

#vim/usr/local/jboss-4.2.3.GA/server/default/conf/jboss-log4j.xml

Append设置为true重启服务不覆盖日志

添加只有ERROR级别以上才记录日志

删除多余的工程和配置文件

#vim del.sh

#!/bin/bash

cd /usr/local/jboss-4.2.3.GA/server/default/deploy/

rm -rf bsh-deployer.xml

rm -rf client-deployer-service.xml

rm -rf ear-deployer.xml

rm -rf ejb-deployer.xml

rm -rf http-invoker.sar

rm -rf jboss-bean.deployer

rm -rf jms

rm -rf jsr88-service.xml

rm -rf schedule-manager-service.xml

rm -rf scheduler-service.xml

rm -rf sqlexception-service.xml

rm -rf uuid-key-generator.sar

rm -rf jmx-console.war

rm -rf management

cd /usr/local/jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer/ROOT.war

rm -rf *

exit

#sh del.sh

为了让limits配置生效,建议配置完毕重启服务器

第四步、jboss的管理

jboss的启动

# cd /usr/local/jboss-4.2.3.GA/bin

#./run.sh

查看启动信息

#tail –f nohup.out

jboss的停止

#./shutdown.sh -S

查看jboss的运行状态

#ps –ef |grep jboss

 类似资料: