Page 1 of 7 123 ... LastLast
Results 1 to 10 of 67

Thread: HOWTO: Install Tomcat 5.5

  1. #1
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    22

    HOWTO: Install Tomcat 5.5

    Installing Tomcat on Ubuntu

    Versions:
    SDK: 1.5
    JRE: 1.5
    Tomcat: 5.5

    Step 1 – Install JRE and SDK

    Download and install the Java Software Development Kit (SDK) and J2SE Runtime Environment (JRE). These packages are available through Synaptic (the extra repositories have to be added).

    Or in terminal type:

    Code:
    sudo apt-get install sun-j2re1.5
    sudo apt-get install sun-j2sdk1.5
    N.B. SDK is 146MB and JRE is 84.7MB.

    You can verify that both items were installed corectly, by checking that you get a response when typing in terminal:

    Code:
    java -version
    javac -help
    Step 2 – Get tomcat

    Download tomcat 5.5 from http://jakarta.apache.org/site/downloads/

    In this example I am using jakarta-tomcat-5.5.9.tar.gz

    Uncompress the file:

    Code:
    tar xvfz jakarta-tomcat-5.5.9.tar.gz
    N.B. To make things simpler I also renamed the package to just 'tomcat'. If you do not do this, make sure you adjust these tutorial instructions to the name of your package whenever you see 'tomcat' written.

    Step 3 – Add tomcat

    Place the uncompressed package in:

    /usr/local/

    Step 4 – Set JAVA_HOME and CLASSPATH

    You need to point out where you installed Java SDK. You will have to edit the file '.bashrc'. Backup this file first!

    In terminal type:

    Code:
    gedit ~/.bashrc
    Add the following lines to the file:

    Code:
    #Stuff we added to make tomcat go
    export JAVA_HOME=/usr/lib/j2sdk1.5-sun/
    export CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar:/usr/local/tomcat/common/lib/servlet-api.jar
    N.B. remember to change the word tomcat to the name of the package you placed in /usr/local.

    Save and close. You will have to log out and back in again before these changes take effect.


    The next steps are optional. They are for setting tomcat up to be used as a development environment. Skip to the last step ( Step 8 ) if you just want to start tomcat how it is.


    Step 5 – Change default port number


    Tomcats default port number is 8080. To change it to 80 or another number do the following.

    In terminal type:

    Code:
    gedit usr/local/tomcat/conf/server.xml
    Find the lines:

    Code:
    <Connector port="8080" ...
    	maxThreads="150" minSpareThreads="25" ...
    Adjust the port number to 80 (or any other port number you want to use), save and close.

    Step 6 – Turn on Servlet reloading

    In terminal type:

    Code:
    gedit usr/local/tomcat/conf/context.xml
    Find:

    Code:
    <Context>
    Change it to:

    Code:
    <Context reloadable="true">
    Save and close.

    Step 7 – Enable Invoker Servlet


    In terminal type:

    Code:
    gedit usr/local/tomcat/conf/web.xml
    Find and uncomment (remove the <-- and --> wrapped around the tags):
    Code:
     <servlet>
            <servlet-name>invoker</servlet-name>
            <servlet-class>
              org.apache.catalina.servlets.InvokerServlet
            </servlet-class>
            ...
        </servlet>
    Also find and uncomment:

    Code:
        <servlet-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    Save and close.

    Step 8 – Start tomcat

    Tomcat should now be ready to run.

    In terminal type:

    Code:
    sh /usr/local/tomcat/bin/startup.sh
    If everything is working fine, you will see the following lines:

    Code:
    Using CATALINA_BASE:   /usr/local/tomcat
    Using CATALINA_HOME:   /usr/local/tomcat
    Using CATALINA_TMPDIR: /usr/local/tomcat/temp
    Using JRE_HOME:       /usr/lib/j2sdk1.5-sun/
    In your browser head to http://localhost/ and test if it is serving. If you didn't change the port number it was serving on, head to http://localhost:8080/

    To stop tomcat type:
    Code:
    sh /usr/local/tomcat/bin/shutdown.sh

    -----

    I hope this helped! 8)

    If you have any problems, I recommend this site for more details: http://www.coreservlets.com/
    Last edited by noodle; July 31st, 2005 at 02:15 AM.

  2. #2
    Join Date
    Dec 2004
    Location
    Santiago, Chile
    Beans
    311
    Distro
    Ubuntu Breezy 5.10

    Re: HOWTO: Install Tomcat 5.5

    great! just in time for my polls project.

    Now, to look for eclipse

  3. #3
    Join Date
    Apr 2005
    Location
    Taiwan
    Beans
    74

    Re: HOWTO: Install Tomcat 5.5

    Quote Originally Posted by RastaMahata
    great! just in time for my polls project.

    Now, to look for eclipse
    Another way to install Tomcat is to install NetBeans (http://www.netbeans.org) which come with an embeded Tomcat server. All pre-configured

  4. #4
    Join Date
    Jun 2005
    Beans
    5

    Re: HOWTO: Install Tomcat 5.5

    Thank you, noodle.

    I have been able to install Tomcat 5.5 on my ubuntu.

    But I want it to run as a service, so I modified a little this process.

    1. I omitted step 4
    2. I put in /etc/init.d a file called tomcat with this script

    Code:
    #!/bin/bash
    #
    # Startup script for the Tomcat server
    #
    # chkconfig: - 83 53
    # description: Starts and stops the Tomcat daemon.
    # processname: tomcat
    # pidfile: /var/run/tomcat.pid
    
    
    # See how we were called.
    case $1 in
    	start)
    
    		export JAVA_HOME=/usr/lib/j2sdk1.5-sun/
    		export CLASSPATH=/usr/local/tomcat/common/lib/servlet-api.jar
    		export CLASSPATH=/usr/local/tomcat/common/lib/jsp-api.jar
    		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
    	;;
    	*)
    		echo "Usage: /etc/init.d/tomcat start|stop|restart"
    	;;
    esac
    
    exit 0
    3. I executed this lines:

    Code:
    chmod 755 /etc/init.d/tomcat
    ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
    ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
    and now my tomcat is there when I start up my linux

    BE AWARE: My experience with linux is very, very limited. I cannot be sure this lines of code are perfect. I just can say they work for me.
    Last edited by jreymol; July 4th, 2005 at 04:16 PM.

  5. #5
    Join Date
    Jun 2005
    Beans
    50

    Re: HOWTO: Install Tomcat 5.5

    when i follow this it doesn't work.
    it loads everything fine, but when i try to connect to localhost:8080 it says connection refused..

    any idea what i can do to fix it?

    Code:
    root@dev:/usr/local/tomcat/conf # sh /usr/local/tomcat/bin/startup.sh
    Using CATALINA_BASE:   /usr/local/tomcat
    Using CATALINA_HOME:   /usr/local/tomcat
    Using CATALINA_TMPDIR: /usr/local/tomcat/temp
    Using JRE_HOME:       /usr/lib/j2sdk1.5-sun/
    any ideas?
    i followed the how to step by step?
    double your hard drive space... delete windows

  6. #6
    Join Date
    Jun 2005
    Beans
    5

    Re: HOWTO: Install Tomcat 5.5

    hello, cope!

    I have just started a new tomcat instalation and it works.

    have you changed port in step 5?

    if you have set 80 as tomcat default port localhost:8080 will say you conection refused just because tomcat isn't listening there.

    Have you see logs in tomcat/log?

    The only problem I'm having is with my /etc/init.d/tomcat script. Cut an paste from web page to gedit doesn't work because cr+lf are lost. I have cut and paste through windows with notepad and I see it right, but when I transfer it from widows to ubuntu I cannot get it to run.

    But seeing your post it seems your tomcat is running. I think it's the port number.

  7. #7
    Join Date
    Jun 2005
    Beans
    50

    Re: HOWTO: Install Tomcat 5.5

    Quote Originally Posted by jreymol
    hello, cope!

    I have just started a new tomcat instalation and it works.

    have you changed port in step 5?

    if you have set 80 as tomcat default port localhost:8080 will say you conection refused just because tomcat isn't listening there.

    Have you see logs in tomcat/log?

    The only problem I'm having is with my /etc/init.d/tomcat script. Cut an paste from web page to gedit doesn't work because cr+lf are lost. I have cut and paste through windows with notepad and I see it right, but when I transfer it from widows to ubuntu I cannot get it to run.

    But seeing your post it seems your tomcat is running. I think it's the port number.
    port number is 8080, i think i had to define the java home in bashrc which i hadn't done. all working fine now.
    double your hard drive space... delete windows

  8. #8
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    22

    Re: HOWTO: Install Tomcat 5.5

    With bashrc you have to logout and back in again before the changes take effect.

    If you didn't want to alter your bashrc file, you can still start tomcat, by first typing in terminal:

    Code:
    export JAVA_HOME=/usr/lib/j2sdk1.5-sun/
    export CLASSPATH=/usr/local/tomcat/common/lib/servlet-api.jar:/usr/local/tomcat/common/lib/jsp-api.jar
    However, this would have to be done everytime you wanted to start tomcat and you were using a new session. On the positive side, using this method is quicker when your setting up tomcat on the fly.

    I think jreymol had the best idea, which was running it as a service. And the paths are declared everytime tomcat is started.

    Oh, and another tip:

    .bashrc is global. You can add the lines to .bash_profile if you just want to add it to declare the paths in your user profile - both will work.
    Last edited by noodle; July 31st, 2005 at 02:18 AM.

  9. #9
    Join Date
    May 2005
    Location
    Belgium
    Beans
    1

    Re: HOWTO: Install Tomcat 5.5

    hey,

    i would like to run java, eclipse and tomcat on ubuntu x86, but i don't know which extra repositories to add. which are they and how can i add them ?

    any help would be great,

    thanks,
    tomaski

    belgium

  10. #10
    Join Date
    Jun 2005
    Location
    Australia
    Beans
    22

    Re: HOWTO: Install Tomcat 5.5

    I installed all the extra repositories in the starter guide . I'm not sure whats in which one, but I can get everything I need from just those.

Page 1 of 7 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •