ubuntu安装jboss
一、安装JAVA环境
?? 1、下载JDK,下载地址:http://download.oracle.com/auth/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz?e=1312777176&h=d051c35355b0996845e273c94427c5a5
?? 2、解压tar包到、/usr/local/jdk目录下。
?? 3、设置环境变量:
??????? vi /etc/environment?? 修改PATH,在当中添加/JAVA_HOME/bin目录。
4、重新登录,输入java -version查看java版本。
?
二、安装JBOSS
?? 1、下载JBOSS,到JBOSS官网下载5.0版本
?? 2、解压tar包
?? 3、设置环境变量:
??????? vi /etc/environment?? 修改PATH,在当中添加/JBOSS_HOME/bin目录。
?? 4、生成启动脚本(JDK和JBOSS路劲需要修改成你自己的安装路径)
?
vi /etc/init.d/jboss 脚本内容如下:#!/bin/sh## $Id: jboss_init_redhat.sh 81068 2008-11-14 15:14:35Z dimitris@jboss.org $## JBoss Control Script## To use this script run it as root - it will switch to the specified user## Here is a little (and extremely primitive) startup/shutdown script# for RedHat systems. It assumes that JBoss lives in /usr/local/jboss,# it's run by user 'jboss' and JDK binaries are in /usr/local/jdk/bin.# All this can be changed in the script itself.## Either modify this script for your requirements or just ensure that# the following variables are set correctly before calling the script. #define where jboss is - this is the directory containing directories log, bin, conf etcJBOSS_HOME=${JBOSS_HOME:-"/opt/jboss"}#define the user under which jboss will run, or use 'RUNASIS' to run as the current userJBOSS_USER=${JBOSS_USER:-"jboss"}#make sure java is in your pathJAVAPTH=${JAVAPTH:-"/usr/lib/jvm/java-6-sun"}#configuration to use, usually one of 'minimal', 'default', 'all'JBOSS_CONF=${JBOSS_CONF:-"default"}#the host where jboss should answer. o.o.o.o means answer all calls. set this to yourhost.comJBOSS_HOST=${JBOSS_HOST:-"0.0.0.0"}#Uncomment this line to store the console output, otherwise it's sent to /dev/nullJBOSS_CONSOLE=${JBOSS_CONSOLE:+"$JBOSS_HOME/server/$JBOSS_CONF/log/console.log"}#if JBOSS_HOST specified, use -b to bind jboss services to that addressJBOSS_BIND_ADDR=${JBOSS_BIND_ADDR:-"-b $JBOSS_HOST"}#define the classpath for the shutdown classJBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}#define the script to use to start jbossJBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}if [ "$JBOSS_USER" = "RUNASIS" ]; then SUBIT=""else SUBIT="su - $JBOSS_USER -c "fi if [ -n "$JBOSS_CONSOLE" -a?! -d "$JBOSS_CONSOLE" ]; then # ensure the file exists touch $JBOSS_CONSOLE if [?! -z "$SUBIT" ]; then chown $JBOSS_USER $JBOSS_CONSOLE fifi if [ -n "$JBOSS_CONSOLE" -a?! -f "$JBOSS_CONSOLE" ]; then echo "WARNING: location for saving console log invalid: $JBOSS_CONSOLE" echo "WARNING: ignoring it and using /dev/null" JBOSS_CONSOLE="/dev/null"fi #define what will be done with the console logJBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"} if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then export PATH=$PATH:$JAVAPTHfi if [?! -d "$JBOSS_HOME" ]; then echo JBOSS_HOME does not exist as a valid directory?: $JBOSS_HOME exit 1fi echo JBOSS_CMD_START = $JBOSS_CMD_START case "$1" instart) cd $JBOSS_HOME/bin if [ -z "$SUBIT" ]; then eval $JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 & else $SUBIT "$JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &" fi?;;stop) if [ -z "$SUBIT" ]; then $JBOSS_CMD_STOP else $SUBIT "$JBOSS_CMD_STOP" fi?;;restart) $0 stop $0 start?;;*) echo "usage: $0 (start|stop|restart|help)"esac
???? 然后使该init脚本生效
?
chown root:root /etc/init.d/jbosschmod ug+x /etc/init.d/jbossupdate-rc.d jboss defaults
???
??? 启动JBoss
/etc/init.d/jboss start
??
?? 卸载JBoss
?
/etc/init.d/jboss stoprm -vf /etc/init.d/jboss //删除启动脚本rm -rvf /opt/jboss //删除jboss目录