我这里安装的是JBOSS5
1、下载JBoss-5.1.0.GA.zip,下载网址http://sourceforge.net/projects/jboss/files/JBoss/JBoss-5.1.0.GA/
下载JDK安装包jdk-6u13-dlj-linux-i586.bin
,下载地址 http://download.chinaunix.net/download.php?ResourceID=61&id=33951
2、把上面下载的安装包放到/opt目录下(你也可以放到别的目录)。
赋予这两个安装包执行权限
[[email protected] opt]# chmod 755 jboss-5.1.0.GA.zip
[[email protected] opt]# unzip jboss-5.1.0.GA.zip
[[email protected] opt]#chmod 755 jdk-6u13-dlj-linux-i586.bin
3、安装配置JDK
[[email protected] opt]#./ jdk-6u13-dlj-linux-i586.bin
[[email protected] opt]# ll
total 208640
drwxr-xr-x. 8 root root 4096 May 22 2009 jboss-5.1.0.GA
-rwxr-xr-x. 1 root root 133466607 Dec 14 19:00 jboss-5.1.0.GA.zip
drwxr-xr-x. 10 root root 4096 Mar 14 2009 jdk1.6.0_13
-rwxr-xr-x. 1 root root 80161911 Dec 14 19:26
jdk-6u13-dlj-linux-i586.bin
drwxr-xr-x. 2 root root 4096 May 17 2013 rh
[[email protected] opt]#vi
/etc/profile
export JAVA_HOME=/opt/jdk1.6.0_13 --这是jdk的那个文件夹的路径
export JRE_HOME=$JAVA_HOME/jre --这是jdk文件夹中的jre的路径
export
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/htmlconverter.jar:$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/lib/sa-jdi.jar
--这是jdk文件夹中lib路径下的一些jar
export PATH=$PATH:$JAVA_HOME/bin
在这个配置文件中加入以上内容
[[email protected] opt]#source /etc/profile
--使配置生效
[[email protected] opt]#java -version
--查看jdk版本
java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
注意这里查看出来的版本是1.7.0_45,但实际是jdk1.6.0_13,这并不相符
下面使用以下命令查看
[[email protected] opt]#which java
--可以看到java命令所在的路径,此时把这个路径下的java重命名为javabak,这样就不会调用系统本身自带的java,就会调用我们加入的jdk,显示出我们的jdk的版本
4、JBOSS安装
[[email protected]
opt]#cd /opt/jboss-5.1.0.GA/bin
[[email protected] opt]#./run.sh
但并不如意,报错了
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/jboss-5.1.0.GA
JAVA: /opt/jdk1.6.0_13/bin/java
JAVA_OPTS: -Dprogram.name=run.sh -Xms128m -Xmx512m -XX:MaxPermSize=256m
-Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true
CLASSPATH: /opt/jboss-5.1.0.GA/bin/run.jar
=========================================================================
Error occurred during initialization of VM
java/lang/NoClassDefFoundError:
java/lang/Object
出现这个报错,你可以去查看一下 jdk的目录里面lib和jre/lib 里面的rt和tools是否为rt.pack
和 tools.pack
如果是,那就使用bin里面的unpack200这个工具,
[[email protected]
lib]# pwd
/opt/jdk1.6.0_13/jre/lib
[[email protected] lib]# ll
total 20304
drwxr-xr-x. 2 root root
4096 Mar 9 2009 applet
drwxr-xr-x. 2 root root
4096 Mar 14 2009 audio
-r--r--r--. 1 root root
1215 Mar 9 2009 calendars.properties
-rw-r--r--. 1 root root
3471822 Mar 14 2009 charsets.pack
-rw-r--r--. 1 root root
79129 Mar 9 2009 classlist
drwxr-xr-x. 2 root root
4096 Mar 14 2009 cmm
-r--r--r--. 1 root root
5874 Mar 9 2009 content-types.properties
drwxr-xr-x. 2 root root
4096 Mar 14 2009 deploy
-rw-r--r--. 1 root root
1230687 Mar 14 2009 deploy.pack
drwxr-xr-x. 5 root root
4096 Mar 14 2009 desktop
drwxr-xr-x. 2 root root
4096 Mar 14 2009 ext
-r--r--r--. 1 root root
3878 Mar 9 2009 flavormap.properties
-r--r--r--. 1 root root
1678 Mar 9 2009 fontconfig.bfc
-r--r--r--. 1 root root
1973 Mar 9 2009 fontconfig.properties.src
-r--r--r--. 1 root root
5438 Mar 9 2009 fontconfig.RedHat.2.1.bfc
-r--r--r--. 1 root root
9060 Mar 9 2009 fontconfig.RedHat.2.1.properties.src
-r--r--r--. 1 root root
5760 Mar 9 2009 fontconfig.RedHat.3.bfc
-r--r--r--. 1 root root
11040 Mar 9 2009 fontconfig.RedHat.3.properties.src
-r--r--r--. 1 root root
4494 Mar 9 2009 fontconfig.RedHat.4.bfc
-r--r--r--. 1 root root
8816 Mar 9 2009 fontconfig.RedHat.4.properties.src
-r--r--r--. 1 root root
4532 Mar 9 2009 fontconfig.RedHat.bfc
-r--r--r--. 1 root root
8878 Mar 9 2009 fontconfig.RedHat.properties.src
-r--r--r--. 1 root root
4644 Mar 9 2009 fontconfig.Sun.bfc
-r--r--r--. 1 root root
8679 Mar 9 2009 fontconfig.Sun.properties.src
-r--r--r--. 1 root root
1678 Mar 9 2009 fontconfig.SuSE.bfc
-r--r--r--. 1 root root
1972 Mar 9 2009 fontconfig.SuSE.properties.src
-r--r--r--. 1 root root
4668 Mar 9 2009 fontconfig.Turbo.bfc
-r--r--r--. 1 root root
9233 Mar 9 2009 fontconfig.Turbo.properties.src
drwxr-xr-x. 2 root root
4096 Mar 14 2009 fonts
drwxr-xr-x. 9 root root
4096 Mar 14 2009 i386
drwxr-xr-x. 2 root root
4096 Mar 14 2009 im
drwxr-xr-x. 4 root root
4096 Mar 14 2009 images
-rw-r--r--. 1 root root
189467 Mar 14 2009 javaws.pack
-r--r--r--. 1 root root
88256 Mar 9 2009 jce.jar
-rwxr-xr-x. 1 root root
15853 Mar 9 2009 jexec
-rw-r--r--. 1 root root
153290 Mar 14 2009 jsse.pack
-r--r--r--. 1 root root
2807 Mar 9 2009 jvm.hprof.txt
drwxr-xr-x. 15 root root
4096 Mar 14 2009 locale
-r--r--r--. 1 root root
2245 Mar 9 2009 logging.properties
drwxr-xr-x. 2 root root
4096 Mar 14 2009 management
-rw-r--r--. 1 root root
382 Mar 9 2009 management-agent.jar
-rw-r--r--. 1 root root
1914 Mar 9 2009 meta-index
-r--r--r--. 1 root root
3070 Mar 9 2009 net.properties
drwxr-xr-x. 2 root root
4096 Mar 14 2009 oblique-fonts
-rw-r--r--. 1 root root
500450 Mar 14 2009 plugin.pack
-r--r--r--. 1 root root
10669 Mar 9 2009 psfontj2d.properties
-r--r--r--. 1 root root
3070 Mar 9 2009 psfont.properties.ja
-rw-r--r--. 1 root root
1140700 Mar 9 2009 resources.jar
-rw-r--r--. 1 root root
13638155 Mar 14 2009 rt.pack
drwxr-xr-x. 2 root root
4096 Mar 14 2009 security
drwxr-xr-x. 2 root root
4096 Mar 14 2009 servicetag
-r--r--r--. 1 root root
1210 Mar 9 2009 sound.properties
drwxr-xr-x. 13 root root
4096 Mar 14 2009 zi
[[email protected] lib]# unpack200 rt.pack rt.jar
[[email protected] lib]# pwd
/opt/jdk1.6.0_13/lib
[[email protected] lib]# ll
total 20680
-rw-r--r--. 1 root root 15555306
Mar 9 2009 ct.sym
-rw-r--r--. 1 root root 145492
Mar 9 2009 dt.jar
-rw-r--r--. 1 root root 205973
Mar 9 2009 htmlconverter.jar
-r--r--r--. 1 root root 18381
Mar 9 2009 ir.idl
-rw-r--r--. 1 root root 393222
Mar 9 2009 jconsole.jar
-rwxr-xr-x. 1 root root 15853
Mar 9 2009 jexec
-r--r--r--. 1 root root 429
Mar 9 2009 orb.idl
-rw-r--r--. 1 root root 1525858
Mar 9 2009 sa-jdi.jar
-rw-r--r--. 1 root root 3290417
Mar 14 2009 tools.pack
drwxr-xr-x. 6 root root 4096
Mar 14 2009 visualvm
[[email protected] lib]# uppack200
tools.pack tools.jar
-bash: uppack200: command not
found
[[email protected] lib]# unpack200 tools.pack tools.jar
这样操作之后,再次启动jboss.
[[email protected]
opt]#./run.sh
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /opt/jboss-5.1.0.GA
JAVA: /opt/jdk1.6.0_13/bin/java
JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m
-XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true
-Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
-Djava.net.preferIPv4Stack=true
CLASSPATH:
/opt/jboss-5.1.0.GA/bin/run.jar:/opt/jdk1.6.0_13/lib/tools.jar
=========================================================================
02:40:25,126 INFO [ServerImpl] Starting JBoss (Microcontainer)...
02:40:25,126 INFO [ServerImpl] Release ID: JBoss [The Oracle] 5.1.0.GA
(build: SVNTag=JBoss_5_1_0_GA date=200905221053)
02:40:25,138 INFO [ServerImpl] Bootstrap URL: null
02:40:25,138 INFO [ServerImpl] Home Dir: /opt/jboss-5.1.0.GA
02:40:25,138 INFO [ServerImpl] Home URL: file:/opt/jboss-5.1.0.GA/
02:40:25,138 INFO [ServerImpl] Library URL:
file:/opt/jboss-5.1.0.GA/lib/
02:40:25,140 INFO [ServerImpl] Patch URL: null
02:40:25,140 INFO [ServerImpl] Common Base URL:
file:/opt/jboss-5.1.0.GA/common/
02:40:25,140 INFO [ServerImpl] Common Library URL:
file:/opt/jboss-5.1.0.GA/common/lib/
02:40:25,140 INFO [ServerImpl] Server Name: default
02:40:25,140 INFO [ServerImpl] Server Base Dir:
/opt/jboss-5.1.0.GA/server
02:40:25,140 INFO [ServerImpl] Server Base URL:
file:/opt/jboss-5.1.0.GA/server/
02:40:25,140 INFO [ServerImpl] Server Config URL:
file:/opt/jboss-5.1.0.GA/server/default/conf/
02:40:25,140 INFO [ServerImpl] Server Home Dir:
/opt/jboss-5.1.0.GA/server/default
02:40:25,140 INFO [ServerImpl] Server Home URL:
file:/opt/jboss-5.1.0.GA/server/default/
02:40:25,140 INFO [ServerImpl] Server Data Dir:
/opt/jboss-5.1.0.GA/server/default/data
02:40:25,140 INFO [ServerImpl] Server Library URL:
file:/opt/jboss-5.1.0.GA/server/default/lib/
02:40:25,140 INFO [ServerImpl] Server Log Dir:
/opt/jboss-5.1.0.GA/server/default/log
02:40:25,140 INFO [ServerImpl] Server Native Dir:
/opt/jboss-5.1.0.GA/server/default/tmp/native
02:40:25,141 INFO [ServerImpl] Server Temp Dir:
/opt/jboss-5.1.0.GA/server/default/tmp
02:40:25,141 INFO [ServerImpl] Server Temp Deploy Dir:
/opt/jboss-5.1.0.GA/server/default/tmp/deploy
02:40:26,444 INFO [ServerImpl] Starting Microcontainer,
bootstrapURL=file:/opt/jboss-5.1.0.GA/server/default/conf/bootstrap.xml
启动还是报错,那就是jdk的问题了,因为我再次操作换了个jdk的安装包,就没有dt.pack和tools.pack。说明这个JDK安装包还是有问题的,若启动不报错,那就成功啦。。下一篇文章我还会再次介绍JBOSS5的安装,那一次是比较顺利的,这一次只是告诉大家遇到问题的一些解决办法,希望对大家有所帮助。。