Friday 27 January 2012

How to Install Tomcat in linux


Get the package first


To run Tomcat, you need Java Standard Edition (Java SE), also known as the JDK

Then follow the steps below

# groupadd tomcat

# useradd -g tomcat -s /sbin/nologin -m -d /home/tomcat tomcat 

# md5sum /opt/src/apache-tomcat-6.0.29.tar.gz 

# cd /opt/src/ 

# tar -xzvf apache-tomcat-6.0.29.tar.gz 

# mv apache-tomcat-6.0.29  /usr/local/src/ 

# cd /usr/local/src/apache-tomcat-6.0.29/

# chown -R tomcat.tomcat apache-tomcat-6.0.29/ 

# cd apache-tomcat-6.0.29/ 

# cd bin/ 

# ./version.sh 

# export CATALINA_HOME=/usr/local/src/apache-tomcat-6.0.29
# export CATALINA_BASE=/usr/local/src/apache-tomcat-6.0.29

# su - tomcat -s /bin/sh -c /usr/local/src/apache-tomcat-6.0.29/bin/startup.sh

# top -u tomcat 

# su - tomcat -s /bin/sh -c /usr/local/src/apache-tomcat-6.0.29/bin/shutdown.sh

# top -u tomcat

# cd bin 

# ./catalina.sh run or sh startup.sh or ./startup.sh

To switch as tomcat user
# su - tomcat -s /bin/sh
# su - tomcat -s /bin/bas


if not switching as tomcatuser use the following to run a command
# su - tomcat -s /bin/sh -c path/of/the/command/to/run

change ports of tomcat
# vim conf/server.xml

Tomcat logs
# cd logs/catalina.ou

No comments:

Post a Comment