Apache Tomcat Installation and configuration Steps on Linux

Apache Tomcat is fully compatible with Redhat, CentOS, Ubuntu & other major Linux distributions. We are going to install Apache tomcat on Redhat Linux.

Step 1 Download Latest version tomcat from http://tomcat.apache.org/

[root@Server var]# cd /var

[root@Server var]# wget http://mirror.symnds.com/software/Apache/tomcat/tomcat-8/v8.0.14/bin/apache-tomcat-8.0.14.tar.gz

1

Step 2 Download JDK for Java environment

[root@Server var]# wget http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz

2

[root@server var]# tar -xvzf apache-tomcat-8.0.14.tar.gz
[root@server var]# mv apache-tomcat-8.0.14 tomcat8
[root@server var]# vi /var/tomcat8/conf/server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="loaclhost">

Now you can define your Apache tomcat Port. As above i have define 8080 is my Apache tomcat port.

server.xml

server.xml is tomcat’s main configuration file. It serves two goals:
1. Providing initial configuration for the Tomcat components.
2. Specifying structure for Tomcat, meaning, letting Tomcat boot and build itself by instantiating components as specified in server.xml
Step 3 Define Java Home for Apache Tomcat.

[root@server var]# vi /var/tomcat8/bin/catalina.sh

JAVA_HOME=/var/jdk1.6.0_45

CATALINA_OPTS=”-Dnet.spy.log.LoggerImpl=net.spy.memcached.compat.log.SunLogger -Djava.awt.headless=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false ”

JAVA_OPTS=”-server -d64 -Xms4096m -Xmx4096m -XX:MaxPermSize=512m -XX:MaxNewSize=4096M -XX:ParallelGCThreads=4 -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000 -XX:-EliminateLocks -XX:+UseParallelGC -XX:+ExplicitGCInvokesConcurrent -XX:+UseStringCache -XX:+OptimizeStringConcat -XX:+DoEscapeAnalysis -XX:+UseFastAccessorMethods -Xrs -XX:+ForceTimeHighResolution -XX:+AggressiveOpts -XX:+UseCompressedOops -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false

-Djavax.net.ssl.keyStore=/tmp/vanilla/52.keystore -Djavax.net.ssl.keyStorePassword=changeit”

#-Djavax.net.ssl.trustStore=/opt/tomcat/keystore.jks -Djavax.net.ssl.trustStorePassword=changeit”
3

 

Now, check the version of tomcat and JDK.

4

How to start tomcat services

[root@server var]# sh /var/tomcat88/bin/startup.sh

How to stop tomcat services

[root@server var]# sh /var/tomcat88/bin/shutdown.sh

Various Directories description for Tomcat

bin : Contains startup/shutdown… scripts
conf : Contains various configuration files including server.xml (Tomcat’s main configuration file) and web.xml that sets the default values for the various web applications deployed in Tomcat.
doc : Contains miscellaneous documents regarding Tomcat.
lib : Contains various jar files that are used by Tomcat. On UNIX any file in this directory is appended to Tomcat’s classpath.
logs :This is where Tomcat places it’s log files.
src : The servlet APIs source files. Don’t get excited, though; these are only the empty interfaces and abstract classes that should be implemented by any servlet container.
webapps : Contains sample web applications.

Now check Tomcat is configured correctly or not.

http://IP_ADDRESS_OF_YOUR_SERVER:8080

You should get following output.

5

Free Download Linux e-Books

One comment

  1. sampath says:

    Please mention about tomcat “work” directory…

Leave a Reply

Your email address will not be published. Required fields are marked *