Installation Tomcat using apt-get
sudo apt-get install tomcat7
Install the package using apt-get
sudo apt-get install tomcat7-docs
sudo apt-get install tomcat7-examples
sudo apt-get install tomcat7-admin
The above instruction is more than enough to install the tomcat. If any error happened please follow the below the instructions.
Setup the JDK path for Tomcat
sudo nano /etc/default/tomcat7 : add the JDK path inside the file
Set the path
sudo nano ~/.bashrc
export CATALINA_HOME=/usr/share/tomcat7
Stop Server:
sudo /etc/init.d/tomcat7 stop
Start Server:
sudo /etc/init.d/tomcat7 start
Folder locations of tomcat :
Tomcat bin and lib file location :
/usr/share/tomcat7
Tomcat xml file :
/etc/tomcat7
Tomcat config and webapp files:
/var/lib/tomcat7/
Tomcat JDK and Path Setup
sudo nano /etc/default/tomcat7
To Run Tomcat on port 80
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort=
"8443" />
Change 8080 to 80 in /config/server.xml file
AND
Remove the comment using :
sudo nano /etc/default/tomcat7 and
change #AUTHBIND=no
as AUTHBIND=yes
To remove all the files
sudo apt-get purge libtomcat7-java tomcat6 tomcat6-admin tomcat6-docs tomcat6-examples tomcat7 tomcat7-admin tomcat7-common tomcat7-docs tomcat7-examples tomcat7-user
To check what are the process running on port 80
netstat -tulpn | grep :80
Server.XML user name and password
<role rolename="manager-gui"/>
<user username="Dhanu" password="" roles="manager-gui"/>
<role rolename="admin-gui"/>
<user username="Dhanu" password="" roles="admin-gui"/>
NOTE:
Change the Heap memory in tomcat :
sudo nano /etc/default/tomcat7 and change the line on -Xms value
JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseConcMarkSweepGC"
In Default It’s limited to 128MB.