Install Apache Tomcat 8 on openSUSE 13.2

1

Tomcat Logo

Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle and provides a “pure Java” HTTP web server environment for running the Java codes. Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files.

Here is the step by step guide to install Apache Tomcat 8.0 on RHEL 7 / CentOS 7.

Open Terminal.

Switch to root user.

Install OpenJDK:

Tomcat requires to have java installed on your machine, you can either have Oracle JDK or OpenJDK installed on your machine. Here i used the openjdk, lets install openjdk by issuing the following command.

# zypper install java-1_7_0-openjdk

You can also verify it, by issuing the following command.

# java -version
java version "1.7.0_71"
OpenJDK Runtime Environment (IcedTea 2.5.3) (suse-1.1-x86_64)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Download & Setup Apache Tomcat:

Download the latest version of the Apache Tomcat from the website and save it on your home directory.

# wget http://www.us.apache.org/dist/tomcat/tomcat-8/v8.0.14/bin/apache-tomcat-8.0.14.tar.gz

Download the MD5 file.

# wget --no-check-certificate https://www.apache.org/dist/tomcat/tomcat-8/v8.0.14/bin/apache-tomcat-8.0.14.tar.gz.md5

Verify the md5 check sum of the downloaded Tomcat archive with check sum provided by Apache Tomcat.

# cat apache-tomcat-8.0.9.tar.gz.md5
96063b1e477869e8ff4801d777e8915b *apache-tomcat-8.0.14.tar.gz
# md5sum apache-tomcat-8.0.9.tar.gz
96063b1e477869e8ff4801d777e8915b  apache-tomcat-8.0.14.tar.gz

If both matches, extract the the tomcat on to your desired (/var/local) directory.

# tar -zxvf apache-tomcat-8.0.14.tar.gz -C /usr/local/

Controlling Apache Tomcat:

Apache Tomcat can be started and stopped by the script which comes with package, start the Apache Tomcat.

# /usr/local/apache-tomcat-8.0.14/bin/startup.sh

you will get the following output.

Using CATALINA_BASE:   /usr/local/apache-tomcat-8.0.14
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.14/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/apache-tomcat-8.0.14/bin/bootstrap.jar:/usr/local/apache-tomcat-8.0.14/bin/tomcat-juli.jar
Tomcat started.

You can verify the service running, by default tomcat runs on port no 8080

# netstat -antup | grep 8080
tcp        0      0 :::8080                 :::*                    LISTEN      2340/java

Open the web browser and point to http://ipaddress:8080

openSUSE 13.2 - Tomcat 8 Home Page
openSUSE 13.2 – Tomcat 8 Home Page

Stop Apache Tomcat.

# /usr/local/apache-tomcat-8.0.14/bin/shutdown.sh

Managing the Apache Tomcat:

Tomcat can be managed through the web-manager, the following can be done through that.
Deploy new application, deploy new application on specified context, list the active or in active applications, start and stop the web applications.

Web manager is password protected, requires user name and password to access. Only the user with the “manager-gui” role is allowed to access, these users and roles are defined in tomcat-users.xml. By default “manager-gui” role not defined that file, we need to add it manually.

# vi /usr/local/apache-tomcat-8.0.14/conf/tomcat-users.xml

Place the following two lines just above the last line.

<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>

Start tomcat,

# /usr/local/apache-tomcat-8.0.14/bin/startup.sh

Now tomcat user have access to the web manager.

openSUSE 13.2 - Tomcat 8 Manager
openSUSE 13.2 – Tomcat 8 Manager

Same like, you can define the other roles.

That’s All.

You might also like