The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

By Request: Tomcat 5 on RHE/Fedora

Discussion in 'General Discussion' started by Planet_Master, Apr 5, 2004.

  1. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    I have been inundated with emails and private messages for a tomcat5 install guide for RHE. This was tested on RHE/Fedora and RH 9 but should work with any version.

    Please follow the instructions carefully. There may be quite a bit of configuring but these are the basics to get Tomcat 5 up and running. The great this about Tomcat 5 is the administration and manager areas for adding new apps and basically setting up your users own JVM.

    Start by opening your root shell.

    First thing you want to do is upgrade your Java 2 SDK. The latest version as of this writing is J2SE 1.4.2 (Java 2 SDK, Standard Edition 1.4.2_04). We will use the .rpm and it will automatically install to /usr/java (Java Home)

    As root run the following commands:
    wget http://www.planetgac.net/downloads/j2sdk-1_4_2_04-linux-i586-rpm.bin

    chmod +x j2sdk-1_4_2_04-linux-i586-rpm.bin

    ./j2sdk-1_4_2_04-linux-i586-rpm.bin

    rpm -ivh j2sdk-1_4_2_04-linux-i586.rpm

    Done now
    test your version:
    /usr/java/j2sdk1.4.2_04/bin/java -version

    (You should see the following:
    java version "1.4.2_04"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
    Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

    Set the PATH environment variable.

    PATH="$PATH:/usr/java/j2sdk1.4.2_04/bin:."
    export PATH

    Now lets install Tomcat5
    Installing Tomcat 5.0.19
    Download the binary distribution from Jakarta's Binary Distribution Site.

    As root:
    wget http://apache.tarchive.com/jakarta/tomcat-5/v5.0.19/bin/jakarta-tomcat-5.0.19.tar.gz

    gunzip jakarta-tomcat-5.0.19.tar.gz

    tar xvf jakarta-tomcat-5.0.19.tar

    mv jakarta-tomcat-5.0.19 tomcat (or simply change the folder name with SCP)

    mv tomcat /usr/local

    ln -s /usr/local/tomcat/bin/catalina.sh /usr/local/bin/tomcat (make shortcut)

    tomcat start

    Open a browser and check http://localhost:8080
    (Should get this page: http://www.planetgac.com:8080)

    tomcat stop

    Now set up your path to the :

    As root run the following:
    cd /usr/local/tomcat
    export JAVA_HOME=/usr/java/j2sdk1.4.2_04

    tomcat start

    Edit your httpd.conf
    edit /etc/httpd/conf/httpd.conf

    and add the following (We are using the mod_jk2 module):
    LoadModule jk2_module libexec/mod_jk2.so

    AddModule mod_jk2.c

    AddType text/html .jsp
    AddHandler jakarta-servlet .jsp

    save and exit, restart Apache to make sure it is working correctly.

    *******************************

    Now set up you as administrator and manager:

    edit /usr/local/tomcat/conf/tomcat-users.xml

    You can create a user/password that will allow you access to the Tomcat console for adding apps, servers and users amongst other things.

    For example:
    <user name="craigmcc" password="secret" roles="admin,manager" />

    All users will be defined in this file

    then
    tomcat stop
    tomcat start

    go to http://localhost:8080 and login.

    Start adding apps and users! Easy way to upload WAR files as well! You can also use the JDBC to store user info, please refer to my tutorial on installing the JDBC connectors.

    CLEANUP: Delete the .rpm and tar files to save disk space.

    As I said there is more configuring for your own specifications which can be viewed in the admin panel or manager panel help sections. Please post questions and problems here.

    IMPORTANT! This will not install Tomcat in WHM or chksrvd. You will need to manually install accounts via admin panel.
    I hope to update this with a script that will add Tomcat to WHM in the future.
     
    #1 Planet_Master, Apr 5, 2004
    Last edited: Apr 11, 2004
  2. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
  3. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    Jaust a few notes from the emails I've been getting for this install:

    You should add the following to your server.xml just above </host> (THIS IS NEAR BOTTOM OF FILE):

    <Context path="" docBase="ROOT" debug="0" />
    <DefaultContext reloadable="true" />

    Open root session in shell

    edit /usr/local/tomcat/conf/server.xml

    and make sure this is defined as well:
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">

    Once everything is installed and tomcat is started JSP and servlets should work instantly
     
  4. woolly

    woolly Active Member

    Joined:
    Dec 29, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    I already have tomcat 4 installed on my RHE box. How will i upgrade to tomcat 5?
     
  5. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    Basically you would just delete your current Tomcat directory and remove all entries from your httpd.conf and start a fresh install of tomcat 5. Unfortunately tomcat doesnt offer upgrade scripts like most software we install on our PC's so its a start all over again process.
     
  6. woolly

    woolly Active Member

    Joined:
    Dec 29, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Would i need to re-install mod_jk2 and everything?

    Also, you left out the mod_jk2 installation. Doesn't mod_jk2 have to be compiled or extracted from it's binary?
     
  7. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    You should already have mod_jk2.so in /usr/local/apache/libexec. If you are running any previous version of tomcat this should be already installed. What you definately should do is upgrade your Java JDK to j2sdk1.4.2_04 as explained in the tutorial.
     
  8. woolly

    woolly Active Member

    Joined:
    Dec 29, 2003
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    I already have j2sdk1.4.2_03. Is that ok or do I have to upgrade to the latest Java JDK still?

    So all i have to do is replace the tomcat4 binary with the tomcat5 one?
     
  9. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    I think it would be best to upgrade to j2sdk1.4.2_04 because this is specifically designed for RHE and then upload the tomacat 5 binary as in the post. Its easy to install just a bit of time configuring. What I would do is keep your current version of tomcat while you play with tomcat 5 (just rename as not to conflict with tomcat 4 install) and learn how it runs and how to configure, this way if you have customers that are using the current install their jsp pages will remain live.

    Once installed login to http://localhost:8080 and view the admin and managers panels and the tomcat setup docs.
     
  10. casek

    casek Member

    Joined:
    Apr 24, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    i seem to be missing something here.

    when i attempt to add :

    LoadModule jk2_module libexec/mod_jk2.so
    AddModule mod_jk2.c

    to httpd.conf and restart it wont allow me to, if i comment these lines out i can restart. How do i add mod_j2k ?

    Everything else appears to be working fine.

    http://nyxchange:8080
     
  11. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    Are using AddModule mod_jk2.c? In your post it say you are using AddModule mod_jk2.c
     
  12. casek

    casek Member

    Joined:
    Apr 24, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    whats the difference between the 2 files?

    Basically i dont even have a mod_jk2.so file or a mod_jk2.c file. I know tomcat is running, i just cant figure out how to obtain these files so users can actually make use of .jsp

    should tomcat and or jakarta automatically install these files ? Or do i need to install something different in order to obtain these files?

    The only things ive done was follow your tutorial, and so far everything has worked out really good... your help is much appreciated, thank you.
     
  13. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    Look in /usr/local/apache/libexec and tell me what you see.
    Also what version of JDK (Java) are you using?

    check /etc/httpd/libexec for
    mod_jk.so
    mod_jk2.so

    If you are missing these things you will need to install and compile mod_jk2 which isnt so easy but it really should already be there.

    mod_jk, mod_jk2 are connnectors between Apache and Tomcat

    Excellent step by step here on how to compile mod_jk 2:
    http://tldp.org/HOWTO/MMBase-Inst-HOWTO/jk2.html

    I just wanted to add the following links because these basically walked me through the configuring process. The basic install above gets it started the configuring gets it going.
    From Apache site:
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/index.html

    coreservlets.com:
    http://www.coreservlets.com/Apache-Tomcat-Tutorial/#Change-Port

    OReilly:
    http://www.onjava.com/pub/a/onjava/2003/06/25/tomcat_tips.html

    Doug Sparling
    http://www.dougsparling.com/comp/howto/linux_java.html


    You are better off knowing everything you need to know in configuring for the safest, securest and most efficient Tomcat.
    I hope the above links helps all who install.

    Good Tip: always bookmark the page when you find a quality tutorial!!!!!!!
     
    #13 Planet_Master, Apr 10, 2004
    Last edited: Apr 10, 2004
  14. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    Note that mod_jk2 was developed with Apache2 and may not work on all instances of Apache1.3. It would be safer to go with mod_jk instead.
     
  15. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    This may be true but if you do upgrade the java JDK you can use jk2 on RHE. I have it working anyways. Different servers have different tastes and as I always said Tomcat is one of the most unruly apps acting differently on different boxes.

    For those who want the auto install try dgbakers post here:
    http://forums.cpanel.net/showthread.php?s=&threadid=22887

    Works fine on RHE.
     
  16. dgbaker

    dgbaker Well-Known Member
    PartnerNOC

    Joined:
    Sep 20, 2002
    Messages:
    2,578
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    cPanel Access Level:
    DataCenter Provider
    True very true, it always amazes me how it can work perfectly on 9 machines and on the 10th fail, even though all are basically the same setups.
     
  17. wipl_piyush

    wipl_piyush Well-Known Member

    Joined:
    Oct 31, 2003
    Messages:
    66
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NY
    Hi Planet Master ---

    Great help ....The how to went fine...but a small prob..i got shell access of the server and no gui interface ..also lynx is not working in RHE3..so how could i check http://localhost:8080.

    Restarting httpd :: ok
    Tomcat start :: ok

    Also any word on integration of Tomcat Service in WHM. And how could it enable JSP on the domain ....as i guess the Option in WHM will not work.

    Please help ASAP.
     
  18. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    Should work with http://hostname.com:8080 in your browser.

    IE http://server.planetgac.net:8080

    As for intergrating with WHM, you can use the auto installer posted here for a faster install and configuration:
    http://forums.cpanel.net/showthread.php?s=&threadid=22887
     
  19. wipl_piyush

    wipl_piyush Well-Known Member

    Joined:
    Oct 31, 2003
    Messages:
    66
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NY
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    We need to make sure your java virtual machine is working

    Please ensure the command java -version actually works

    If not you need to get get this fixed
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Error occurred during initialization of VM
    Unable to load native library: /usr/java/j2sdk1.4.0/jre/lib/i386/libjava.so: symbol __libc_waitpid, version GLIBC_2.0 not defined in file libc.so.6 with link time reference

    If the above shows the java version and such you can run install.sh

    If it does not, you need to fix your java environment

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    This the error i got afte using the link u mentioned...might be as i upgraded java as per the post of yours.
     
  20. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker

    No you should update your java JVM for the install. Did you export the path to java?

    Run this command in shell and then try the ./pre-install.sh again

    PATH="$PATH:/usr/java/j2sdk1.4.2_04/bin:."
    export PATH

    Should give you your java version when running ./pre-install.sh
     
Loading...

Share This Page