本篇博文介绍在CentOS 5.8下安装jdk1.5+Jboss4.2.3,及Jboss外部通过IP访问配置,下面直接进入详细步骤:
一、安装jdk1.5:
1、下载jdk1.5:
jdk1.5版本下载地址 :
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html#jdk-1.5.0_22-oth-JPR
根据操作系统版本来选择下载,这里我的操作系统是linux 64位的,所以有如下选择:
这里有两种格式rpm和bin,rpm是linux下一种软件包安装格式,要执行此软件包时需要安装rpm软件包管理器,
bin是linux下可执行文件,这里我们选择.bin格式安装文件:jdk-1_5_0_22-linux-amd64.bin。
2、上传jdk1.5:
我们从客户机上下载好jdk以后,需要上传到我们的CentOS服务器上,关于上传文件到linux下,有很多种方法,这里我们介绍一种非常好用的工具:WinSCP,具体操作方法这里不详述。我们把jdk-1_5_0_22-linux-amd64.bin上传到CentOS的“/usr/java”目录下。
首先以root登录,创建此目录文件夹命令如下:
[root@localhost ~]# cd /usr
[root@localhost ~]# mkdir java
用WinSCP上传文件,如下图:
3、安装jdk1.5:
在ubuntu下进入目录“/usr/java”,查看jdk安装包,命令如下:
[root@localhost ~]# cd /usr/java
[root@localhost java]# ls jdk-1_5_0_22-linux-amd64.bin
修改安装文件权限:
[root@localhost java]# chmod a+x jdk-1_5_0_22-linux-amd64.bin安装jdk到当前目录 “/usr/java”下,命令如下:
[root@localhost java]# ./jdk-1_5_0_22-linux-amd64.bin
一直按回车直到出现yes/no,选择yes,开始安装,当出现Done 时说明已经安装完成。
4、配置环境变量:
查看目录“/usr/java”下安装后的jdk文件夹名称,命令如下:
[root@localhost java]# ls
jdk1.5.0_22 jdk-1_5_0_22-linux-amd64.bin
修改 /etc/profile 文件,在done下一行加入jdk需要的环境变量,命令如下:
[root@localhost java]# vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.5.0_22 export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$PATH:$JAVA_HOME/bin
保存并退出后,执行以下命令,使用配置生效:
[root@localhost java]# source /etc/profile测试jdk是否配置成功,命令如下:
[root@localhost java]# java -version java version "1.5.0_22" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03) Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)版本号相对应,说明配置成功!
二、安装Jboss:
1、下载Jboss:
JBoss 4.2.3的官方下载地址是:http://sourceforge.net/projects/jboss/files/JBoss/JBoss-4.2.3.GA/
压缩包有两种格式:zip和tar.gz,这里我们选择zip压缩包:jboss-4.2.3.GA.zip,如下图:
2、上传Jboss压缩包:
同样,用WinSCP上传到目录“/usr/java”下,如下图:
3、解压Jboss:
在CentOS下进入目录“/usr/java”,查看Jboss压缩包,命令如下:
[root@localhost ~]# cd /usr/java
[root@localhost java]# ls
jboss-4.2.3.GA.zip jdk1.5.0_22 jdk-1_5_0_22-linux-amd64.bin解压Jboss压缩包到当前目录 “/usr/java”下,命令如下:
[root@localhost java]# unzip jboss-4.2.3.GA.zip
4、配置环境变量:
查看目录“/usr/java”下解压后的Jboss文件夹名称,命令如下:
[root@localhost java]# ls
jboss-4.2.3.GA jboss-4.2.3.GA.zip jdk1.5.0_22 jdk-1_5_0_22-linux-amd64.bin
修改 /etc/profile 文件,在文件最后增加Jboss需要的环境变量,命令如下:
[root@localhost java]# vi /etc/profile
export JBOSS_HOME=/usr/java/jboss-4.2.3.GA export PATH=$PATH:$JBOSS_HOME/bin
保存并退出后,执行以下命令,使用配置生效:
[root@localhost java]# source /etc/profile
三、配置Jboss参数:
安装好Jboss后,默认访问的地址是:http://localhost:8080,这样只能在本机访问,若要实现客户机通过服务器的IP地址来访问该服务器的话,需要配置Jboss参数。
打开Jboss安装路径“/jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer”目录下的“server.xml”文件,命令如下:
[root@localhost java]# cd jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer
[root@localhost jboss-web.deployer]# ls
conf context.xml jasper-jdt.jar jbossweb-extras.jar jbossweb.jar jbossweb-service.jar jsf-libs jstl.jar META-INF ROOT.war server.xml
[root@localhost jboss-web.deployer]# vi server.xml找到如下信息:
<Connector port="8080" address="${jboss.bind.address}" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />把 address里的 "${jboss.bind.address}"改成你的服务器IP地址,如下:
<Connector port="8080" address="10.100.1.114" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" />保存并退出!
四、配置防火墙允许访问8080端口:
CentOS防火墙默认是打开的,设置CentOS防火墙开放端口方法如下:
打开iptables的配置文件,命令如下:
[root@localhost ~]# vi /etc/sysconfig/iptables
添加一条开放8080端口的命令:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
五、启动Jboss:
进入目录“/jboss-4.2.3.GA/bin”,启动“run.sh”,命令如下:
[root@localhost bin]# ./run.sh
========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /usr/java/jboss-4.2.3.GA JAVA: /usr/java/jdk1.5.0_22/bin/java JAVA_OPTS: -Dprogram.name=run.sh -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true CLASSPATH: /usr/java/jboss-4.2.3.GA/bin/run.jar:/usr/java/jdk1.5.0_22/lib/tools.jar ========================================================================= 20:01:24,878 INFO [Server] Starting JBoss (MX MicroKernel)... 20:01:24,880 INFO [Server] Release ID: JBoss [Trinity] 4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417) 20:01:24,883 INFO [Server] Home Dir: /usr/java/jboss-4.2.3.GA 20:01:24,883 INFO [Server] Home URL: file:/usr/java/jboss-4.2.3.GA/ 20:01:24,886 INFO [Server] Patch URL: null 20:01:24,886 INFO [Server] Server Name: default 20:01:24,886 INFO [Server] Server Home Dir: /usr/java/jboss-4.2.3.GA/server/default 20:01:24,887 INFO [Server] Server Home URL: file:/usr/java/jboss-4.2.3.GA/server/default/ 20:01:24,887 INFO [Server] Server Log Dir: /usr/java/jboss-4.2.3.GA/server/default/log 20:01:24,888 INFO [Server] Server Temp Dir: /usr/java/jboss-4.2.3.GA/server/default/tmp 20:01:24,890 INFO [Server] Root Deployment Filename: jboss-service.xml 20:01:25,391 INFO [ServerInfo] Java version: 1.5.0_22,Sun Microsystems Inc. 20:01:25,392 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 1.5.0_22-b03,Sun Microsystems Inc. 20:01:25,393 INFO [ServerInfo] OS-System: Linux 2.6.18-308.el5,amd64 20:01:26,196 INFO [Server] Core system initialized 20:01:30,953 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/ 20:01:30,956 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml 20:01:31,955 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc. 20:01:31,956 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer 20:01:32,226 INFO [TransactionManagerService] Starting recovery manager 20:01:32,372 INFO [TransactionManagerService] Recovery manager started 20:01:32,373 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference 20:01:37,321 INFO [EJB3Deployer] Starting java:comp multiplexer 20:01:41,906 INFO [NativeServerConfig] JBoss Web Services - Native 20:01:41,907 INFO [NativeServerConfig] jbossws-3.0.1-native-2.0.4.GA (build=200803312044) 20:01:43,839 INFO [Embedded] Catalina naming disabled 20:01:44,057 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/jdk1.5.0_22/jre/lib/amd64/server:/usr/java/jdk1.5.0_22/jre/lib/amd64:/usr/java/jdk1.5.0_22/jre/../lib/amd64 20:01:44,380 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-10.100.1.114-8080 20:01:44,382 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009 20:01:44,383 INFO [Catalina] Initialization processed in 543 ms 20:01:44,383 INFO [StandardService] Starting service jboss.web 20:01:44,388 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA 20:01:44,474 INFO [Catalina] Server startup in 91 ms 20:01:44,643 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/ 20:01:45,716 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/ 20:01:46,120 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/jbossws.sar/jbossws-context.war/ 20:01:46,298 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/ 20:01:48,167 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/ 20:01:49,131 INFO [MailService] Mail Service bound to java:/Mail 20:01:49,494 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar 20:01:49,587 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar 20:01:49,629 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar 20:01:49,683 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar 20:01:49,784 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar 20:01:49,833 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/mail-ra.rar 20:01:49,902 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar 20:01:49,916 INFO [QuartzResourceAdapter] start quartz!!! 20:01:50,016 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main 20:01:50,063 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created. 20:01:50,081 INFO [RAMJobStore] RAMJobStore initialized. 20:01:50,083 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' 20:01:50,084 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2 20:01:50,085 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started. 20:01:51,046 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS' 20:01:51,495 INFO [A] Bound to JNDI name: queue/A 20:01:51,499 INFO [B] Bound to JNDI name: queue/B 20:01:51,504 INFO [C] Bound to JNDI name: queue/C 20:01:51,511 INFO [D] Bound to JNDI name: queue/D 20:01:51,514 INFO [ex] Bound to JNDI name: queue/ex 20:01:51,549 INFO [testTopic] Bound to JNDI name: topic/testTopic 20:01:51,554 INFO [securedTopic] Bound to JNDI name: topic/securedTopic 20:01:51,558 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic 20:01:51,565 INFO [testQueue] Bound to JNDI name: queue/testQueue 20:01:51,643 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093 20:01:51,710 INFO [DLQ] Bound to JNDI name: queue/DLQ 20:01:51,906 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA' 20:01:52,027 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/ 20:01:52,556 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-10.100.1.114-8080 20:01:52,593 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009 20:01:52,610 INFO [Server] JBoss (MX MicroKernel) [4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)] Started in 27s:716ms
在客户机浏览器中输入地址:http://10.100.1.114:8080,如下图:
配置成功!
原创作品,转载请注明出处:http://blog.csdn.net/xiezuoyong/article/details/39076807