Hi can any one tell me the installation process of Tomacat5.5 or higher version in Ubuntu.
These are my questions for tomcat installation:
- How to install Tomcat in Ubuntu?
2.How to start an stop the Tomcat server?
Hi can any one tell me the installation process of Tomacat5.5 or higher version in Ubuntu.
These are my questions for tomcat installation:
2.How to start an stop the Tomcat server?
To install tomcat 6 for a server you need to install the tomcat6 package from a commandline:
sudo apt-get install tomcat6
To install tomcat 7 for a server you need to install the tomcat7 package from a commandline:
sudo apt-get install tomcat7
To install tomcat 6 for a user (e.g developer) you need to install the tomcat6 package from a commandline:
sudo apt-get install tomcat6-user
To install tomcat 7 for a user (e.g. developer) you need to install the tomcat7 package from a commandline:
sudo apt-get install tomcat7-user
NOTE you can only have one version (6 or7) installed at a time.
To start and stop the server:
sudo service tomcat6 stop
sudo service tomcat6 start
or to restart
sudo service tomcat6 restart
Further reading:
in terminal type:
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:
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:
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:
gedit ~/.bashrc
Add the following lines to the file:
#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:
gedit usr/local/tomcat/conf/server.xml
Find the lines:
<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:
gedit usr/local/tomcat/conf/context.xml
Find:
<Context>
Change it to
<Context reloadable="true">
Save and close.
Step 7 – Enable Invoker Servlet
In terminal type:
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:
<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:
sh /usr/local/tomcat/bin/startup.sh
If everything is working fine, you will see the following lines:
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.
To stop tomcat type:
sh /usr/local/tomcat/bin/shutdown.sh
Enjoy
Source: how to install tomcat 5.5