Home
Login
Contact
Articles
Newsletter
Bookmark and Share
XSLT
CSS
Javascript
Java
Linux
Username
Password
Annuler
Connexion

Recent Articles

javascript print partial pages

In developping web applications and designing websites, you've probably come accross a situation where you wanted the user to be able to press a print...

Marquee in javascript

The Marquee Element has been deprecated by the W3C and is commonly ill-advised but nevertheless, if you really want to do it, then javascript is the w...

Sending an email in Java

Sending an email in Java is actually quite simple, as always, there is an API that will do most of the work for you and it becomes just a matter of im...

Opacity in Firefox 3.5

If you've upgraded to Firefox 3.5 and you've been using -moz-opacity in your CSS, then you will see that the transparency or opacity (depending on ho...

Installing Tomcat on Linux in a few minutes

Installing tomcat is actually very quick and easy. Assuming you already have the JDK installed, this will only take a few minutes. In my years of exp...

Installing Tomcat on Linux in a few minutes

Matt Castonguay, 04 August at 01:21PM 

Installing tomcat is actually very quick and easy. Assuming you already have the JDK installed, this will only take a few minutes. In my years of experience as a sysadmin I've had to install tomcat a billion times (well maybe not that many, but quite a few) and I actually have a script which does it for me. In this article, I will go over the few easy steps to get tomcat up and running.

First of all, you need to download tomcat. The software is already compiled and ready to go on all major distros. At the time that I am writing this article, version 6.0.20 is the latest, but you may consult the download page for newer versions if they exist.

wget http://apache.sunsite.ualberta.ca/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz

 

Choosing the extraction directy is really up to how you configure your box. In this case, I will extract it to /etc/ and then rename the long directory name to /etc/tomcat for simplicity.

cp apache-tomcat-6.0.20.tar.gz /etc/
tar xzvf apache-tomcat-6.0.20.tar.gz
rm apache-tomcat-6.0.20.tar.gz
mv apache-tomcat-6.0.20/ tomcat

 

Next, we need to configure tomcat's port. By default it is 8080, but in the tomcat/conf directory, there is a file called server.xml which allows you to specify which port and which IP tomcat runs on. By default it will listen on 0.0.0.0, but you can add the attribute address to the Connector node for a specific address.

<Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />

 

We're almost done, now we want to make sure that we're using the proper JDK when starting tomcat, you may either set this in the current user's profile, in the /etc/profile or simply modify the tomcat/bin/catalina.sh and add this line (where the value is the location of the JDK's home directory):

export JAVA_HOME=/usr/java/jdk1.6.0_14

 

Lastly, we want to link that script to our etc/init.d to keep it inline with other configurations.

cd /etc/init.d
ln -s /etc/tomcat/bin/catalina.sh tomcat

 

Afterwards, you can start or stop tomcat with /etc/init.d/tomcat start|stop and if you want it to start automatically when your system boots, you can add a link to your rc#.d where # is the runlevel. If you don't know what your runlevel is, simply type runlevel and it will be indicated.

cd /etc/rc3.d
ln -s /etc/init.d/tomcat S99Tomcat

 

You may now start your tomcat and if you try to browse this box's url (or localhost if you have that access) you should see the tomcat welcome page. Remember to put the port that you specified, so if you are navigating on localhost and left tomcat on port 8080, you should be able to point your browser to http://localhost:8080

For additional support, you may want to use a ProxyPass in apache to mask the port, which is explained in this article.

Enjoy!

 

Category:   Linux

Tags:   tomcat, apache

Random Tags

proxypass    textarea    position    template    apache    optimization    uniques    memory    custom css    min-width    javamail    function    url mapping    xsl:include    modproxy    tinymce    library    apache    position    svn    apply-templates    tomcat    hashmap    offsetleft    xml    caching    mode    marquee    bash    opacity    clear    offsetleft    offsettop    iframe    math    css classes    hashmap    ie6    xsl:import    double negation   
MG2 Media Inc. - A Web Development Company
Top