Thursday, July 28, 2011

Ubuntu Server 11.04 Java + Tomcat6

Ubuntu Server 11.04 Java + Tomcat6

I used following steps.
   1) Install Oracle(Sun) Java
   2) Install Apache Tomcat 6
   3) Linkage with Apache HTTP Server
   4) Additional information
Ubuntu Server 11.04 Java + Tomcat6

I used following steps.
   1) Install Oracle(Sun) Java
   2) Install Apache Tomcat 6
   3) Linkage with Apache HTTP Server
   4) Additional information

   1) Install Oracle(Sun) Java:
      Confirmation of add-apt-repository

      Check tomcat installed or not
      $ dpkg -L python-software-properties
      Install Repo
      $ sudo aptitude -y install python-software-properties
    
      Install Java
      $ sudo add-apt-repository "deb http://archive.canonical.com/ natty partner"
      $ sudo apt-get update
      $ sudo apt-get -y install sun-java6-jdk

      Change default OpenJDK to Sun Java
      $ sudo update-alternatives --config java
      There is only one alternative in link group java: /usr/lib/jvm/java-6-sun/jre/bin/java
      Nothing to configure.

      Confirm Java version
      $ java -version
      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
      Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)

   2) Install Apache Tomcat 6:
                Check already installed or not
                $ dpkg --get-selections | grep tomcat

                Let install if not.
                $ sudo aptitude -y install tomcat6
                Created tomcat6 user and tomcat6 group with this installation
                Created /etc/default/tomcat6 configuration file
                Started tomcat6 sevice automatically

                Connection confirmed with link below
                http://localhost:8080/
                If you see "It works !" page then its installed perfectly.

        3) Linkage with Apache HTTP Server:

                Edit Tomcat 6 server.xml
                Enable connector
                $ sudo vi /var/lib/tomcat6/conf/server.xml
                Comment out of the ""
                <!-- Define an AJP 1.3 Connector on port 8009 -->
                <!--
                <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
                -->
                After edit it looks as below.
                <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

                Add apache proxy_ajp module
                Configuration of the apache proxy_ajp module
                $ sudo vi /etc/apache2/mods-available/proxy_ajp.conf
      Edit as below
                ProxyPass /tomcat/ ajp://localhost:8009/

                Enable apache proxy_ajp module
                $ sudo a2enmod proxy_ajp
                Considering dependency proxy for proxy_ajp:
                Enabling module proxy.
                Enabling module proxy_ajp.
                Run '/etc/init.d/apache2 restart' to activate new configuration!
                Enable module automatically.

                Restart service below
                $ sudo /etc/init.d/tomcat6 restart
                $ sudo /etc/init.d/apache2 restart

                Connection confirmed with link below
                http://192.168.0.60/
                If you see "It works !" page then its installed perfectly.

        4) Additional information:
                Confirmation of package for Tomcat
                $ dpkg --get-selections | grep tomcat
                [Result]
                libtomcat6-java install
                tomcat6         install
                tomcat6-common  install

                Uninstall:
                $ sudo aptitude remove tomcat6
                $ sudo dpkg --purge tomcat6

                Confirmation of package for JAVA
                $ dpkg --get-selections | grep java
                [Result]
                java-common     install
                sun-java6-bin   install
                sun-java6-jdk   install
                sun-java6-jre   install

                Uninstall
                $ sudo aptitude remove sun-java6-jdk
                $ sudo dpkg --purge sun-java6-jre
                $ sudo dpkg --purge sun-java6-jdk
                $ sudo dpkg --purge sun-java6-bin

                Enjoy!

No comments:

Post a Comment