Tomcat 6

When we are working with Java web-apps we can use many servers, to do our job but the most popular web server is Tomcat. So today I’m gonna tell you how to install Tomcat on your machine for all those Linux users. And this is how we do it :D
First you have to have Java to check that you have to enter the following command in the terminal:
Code:
dpkg --get-selections | grep sun-java

And if you get an output like this we are good to go

sun-java6-bin install
sun-java6-jdk install
sun-java6-jre install

but if you don’t get that then you have to install Java too, for that you can use this command
Code:
sudo apt-get install openjdk-6-jdk

Ok now this is how we are going to install Tomcat, first lets go to /etc/apt/sources.list you can use the GUI but if you are not a fan of GUI then you can use the following command in the terminal
Code:
sudo gedit /etc/apt/sources.list

then add these two lines to the end of your source list

deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse

then you have to update the source list
Code:
sudo apt-get update

Then finally after the update you can install tomcat by
Code:
sudo apt-get install tomcat6 tomcat6-docs tomcat6-examples tomcat6-admin

Then after the installation go to /etc/tomcat6/tomcat-users.xml
Code:
sudo gedit /etc/tomcat6/tomcat-users.xml

Then add these two lines inside the tags

< role rolename=”admin” />
< user username=”tomcatman” password=”tomcat” roles=”admin,manager” />

Note:
If the < and > marks are not shown here properly make sure to add them if you are copy pasting this

And how we are ready to start tomcat to start, restart and stop these are the commands
Code:
sudo /etc/init.d/tomcat6 start
sudo /etc/init.d/tomcat6 restart
sudo /etc/init.d/tomcat6 stop

Ok then after starting tomcat you can go to

http://localhost:8080/

start your work :D

~~ Rusiru Boteju ~~

Follow

Get every new post delivered to your Inbox.