Saturday, March 3, 2012

getting tomcat 6 to work on ubuntu 10.04

Finally after an hour of experiment got the tomcat to run successfully ... hoping will help u too ... 

Apache Tomcat is a free and open source software implementation for JavaServlets, providing support for Java Server Pages (JSP). Many popular web-based applications use servlets. You may choose to run Tomcat with either Sun’s Java implementation or the OpenJDK implementation of Java.
Because Tomcat version 6 was included in Ubuntu 10.04, installing a working Tomcat server is reasonably straightforward. However, before we can start installing Tomcat itself, we must first install Java.

First Install Sun Java in ubuntu 10.04

Install tomcat 6 in ubuntu


sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples
 
Start tomcat server


sudo /etc/init.d/tomcat6 start
 
Stop tomcat server

sudo /etc/init.d/tomcat6 stop
 
Restart tomcat server

sudo /etc/init.d/tomcat6 restart
 
Get tomcat server status


sudo /etc/init.d/tomcat6 status
 
After installation type http://localhost:8080 or http://serverip:8080/examples/servlets/ in your browser.Now you should see tomcat welcome page

* To enable admin web based features add the following lines to your /etc/tomcat6/tomcat-user.xml


<role rolename="manager"/>
<role rolename="admin"/>
<user name="admin" password="secret_password" roles="manager,admin"/>
 
* you should be able to see your manage page here http://your_ip_goes_here:8080/manager/html

* log in with the name and password you just set in /etc/tomcat6/tomcat-users.xml

* ls /var/lib/tomcat6 directory.

* you should see these directories conf, logs, webapps, work

* webapps is where your servlets will go ( or at least a xml file that points to them )

* as a test download this war file http://simple.souther.us/SimpleServlet.war

* then use the tomcat management page and select war file to deploy ( in the deploy section) to upload this file to your server

* optionally just wget http://simple.souther.us/SimpleServlet.war directly to the webapps folder

* tomcat should recognize the war file and expand it with everything you need

* browse to http://serverip:8080/SimpleServlet/

Change tomcat server to run on port 80
If you want to Change tomcat server to run on port 80 follow this procedure
You need to edit the /etc/tomcat6/server.xml file

nano /etc/tomcat6/server.xml
 
Now replace the part that says Connector port=”8080? with Connector port=”80?

Save and exit the file
Restart tomcat server with the following command

sudo /etc/init.d/tomcat6 restart

No comments:

Post a Comment