Install JBoss AS in CentOS

a) install JDK, both 1.5 and 1.6 are suitable.

[root@centos ~]# yum install java-1.6*
[root@centos]# vi /etc/profile

JAVA_HOME=/usr/java/jdk1.6.0
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

 [root@centos ~]# 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)

b) install JBoss.

[root@centos ~]# cd /usr/java/jboss-5.1.0.GA
 [root@centos ~]# jar -xf jboss-5.1.0.GA.zip
 [root@centos ~]# vi jboss
#!/usr/bin/python

import os,sys,stat

if len(sys.argv)<2 :
        print 'No action specified.'
	print 'usage: jboss (start|stop|restart)'
        sys.exit()

#change or add an environment variable.:
JBOSS_HOME = '/usr/java/jboss-5.1.0.GA'
os.putenv('JBOSS_HOME', JBOSS_HOME)

STARTCMD = JBOSS_HOME +'/bin/run.sh -c default -b 0.0.0.0 &'
SHUTDOWNCMD = JBOSS_HOME + '/bin/shutdown.sh -S'


option = sys.argv[1]

if option == 'start' :	
        os.system(STARTCMD)

elif option == 'stop' :	
        os.system(SHUTDOWNCMD)

elif option == 'restart' :
	os.system(SHUTDOWNCMD)
	os.system(STARTCMD)

else :
	print 'usage: jboss (start|stop|restart)'
        sys.exit()

  By default JBoss listens only to localhost, keep this in mind, and provide the startup with the “-b 0.0.0.0″ if you want your installation be accessible from anywhere.

[root@centos ~]# chmod 755 jboss
 [root@centos ~]# chmod 755 /usr/java/jboss-5.1.0.GA/bin/*.sh
 [root@centos ~]# ./jboss start
 [root@centos ~]# ./jboss stop

相关推荐