`
xiaoboss
  • 浏览: 641863 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

JBOSS 5.1 on Ubuntu 11.4

阅读更多

Requirements : JDK 6
Ubuntu : 11.4

Download Jboss from link : JbossDownload

Create Directory :

sudo mkdir /usr/local/jboss

Extract contents of the downloaded file into this directory

sudo unzip [downloaded_file_name]

Add user called jboss with this command :

sudo useradd -d /usr/local/jboss -s /bin/sh jboss

Now set ownership of this directory to jboss :

sudo chown -R jboss:jboss /usr/local/jboss

Make a copy of the jboss_init_redhat.sh in the bin directory like so

sudo cp /usr/local/jboss/bin/jboss_init_redhat.sh /usr/local/jboss/bin/jboss_init_ubuntu.sh

Now edit this script to make certain changes

sudo gedit /usr/local/jboss/bin/jboss_init_ubuntu.sh

To set the correct path for Java — > Change line

JAVAPTH=${JAVAPTH:-”/usr/local/jdk/bin”}

to

JAVAPTH=${JAVAPTH:-”/usr/bin”}

And change line

JBOSS_BIND_ADDR=${JBOSS_HOST:+”-b $JBOSS_HOST”}

To

JBOSS_BIND_ADDR=${JBOSS_HOST:+”-b 0.0.0.0″}

Explanation : This binds it on all IP addresses. To bind to a specific address, replace the 0.0.0.0.

Now copy this file to the startup scripts folder

sudo cp /usr/local/jboss/bin/jboss_init_ubuntu.sh /etc/init.d/jboss

To add Jboss to the init system

sudo update-rc.d jboss defaults

Result :

update-rc.d: warning: /etc/init.d/jboss missing LSB information
update-rc.d: see
Adding system startup for /etc/init.d/jboss …
/etc/rc0.d/K20jboss -> ../init.d/jboss
/etc/rc1.d/K20jboss -> ../init.d/jboss
/etc/rc6.d/K20jboss -> ../init.d/jboss
/etc/rc2.d/S20jboss -> ../init.d/jboss
/etc/rc3.d/S20jboss -> ../init.d/jboss
/etc/rc4.d/S20jboss -> ../init.d/jboss
/etc/rc5.d/S20jboss -> ../init.d/jboss

Note : In case you want to remove previous instances of Jboss in the init system run :

sudo update-rc.d -f jboss remove

Now just to be sure about the permissions

sudo chown -R jboss:jboss /usr/local/jboss
sudo chmod -R 755 /usr/local/jboss

Now you can start the server by

sudo /etc/init.d/jboss start

And stop the server by

sudo /etc/init.d/jboss stop

 

 

Installing Tomcat6 on Ubuntu 9.04

If you are running Ubuntu use the manual installation process shown here.

Make sure that Java is installed. Check with the dpkg command like this:

dpkg –get-selections | grep sun-java

This should give this output if java is installed on the system:

sun-java6-bin install
sun-java6-jdk install
sun-java6-jre install

If no results, install the latest version with this command:

sudo apt-get install sun-java6-jdk

Installation

Now we’ll download and extract Tomcat from the apache site . Check latest version number and adjust accordingly.Replace “6.0.14″ below with the latest version number

wget http://apache.hoxt.com/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz
tar xvzf apache-tomcat-6.0.14.tar.gz

Move the tomcat folder to a permanent location. Use for example /usr/local/tomcat.

sudo mv apache-tomcat-6.0.14 /usr/local/tomcat

Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in your .bashrc file. You could also edit your startup.sh file.The better method is editing your .bashrc file and adding the bolded line there. Logout of the shell for the change to take effect. Also while you are at it, set the CATALINA_OPTS variable to whatever is suitable. Incase you have a dedicated server use a large memory allocation.

vi ~/.bashrc

If you have large amount of RAM you can set Tomcat to use minimum of 512mb and maximum of 1024mb (Like in the example below). Add the following lines:

export JAVA_HOME=/usr/lib/jvm/java-6-sun
export CATALINA_OPTS=”-Xms512m -Xmx1024m”

You could also run the JVM in server mode with the -server flag in CATALINA_OPTS. There is supposed to be a speed advantage in the server mode although it is a little slow to start up. Use the following line to run the JVM in server mode.

export CATALINA_OPTS=”-server -Xms512m -Xmx1024m”

Tomcat can be started by just executing the startup.sh script in the tomcat/bin folder.

Automatic Starting

To make tomcat automatically start when we boot up the computer, Add a script to make it auto-start and shutdown.

sudo vi /etc/init.d/tomcat

Now paste in the following:

# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0

Make the script executable by running the chmod command:

sudo chmod 755 /etc/init.d/tomcat

The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Tomcat should now be fully installed !

Setup the Manager Role

As a final step you need to login to the tomcat manager. To do that open up the tomcat/conf/tomcat-users.xml file.

sudo vi /usr/local/tomcat/conf/tomcat-users.xml

Now add the following lines at the end of the file just before the closing ‘</tomcat-users>’. Replace with your username and password at the appropriate places below.

<role rolename=”manager”/>
<user username=”your_user_name_here” password=”your_password_here” roles=”manager”/>

Now all you have to do is to restart tomcat once again.

sudo /etc/init.d/tomcat restart

Now go to the tomcat server – usually found at http://localhost:8080. Click on the link to the manager. Give the username/password you set before – and voila you can now deploy your WAR files !

*****************************************************************
*********** Follow Up 1 – RISKY step ***************************
*****************************************************************

For removing the default install of tomcat6 from ubuntu, first remove the package tomcat6 and any related packages with tomcat6 in the name via synaptic. After that type in terminal

sudo updatedb
locate tomcat6

When you get the list of all files with tomcat6 in the name, go to each of them and delete all of them one by one. That way you are sure there are no traces of the default tomcat6 install left on your system ( You may have to use root permissions to clear certain files – so be careful about what you delete)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics