8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Home » Articles » Linux » Here
Apache Tomcat 7 is not available from the standard RHEL distributions, so this article provides information about the manual installation and basic configuration of Apache Tomcat 7 on RHEL and its clones from tarballs. The tarball approach to installation is largely unchanged compared to previous tomcat versions.
The Apache Tomcat is a Web server that is used for to deploy the Java based web applications. The Tomcat is a web server that is developed by the Apache foundation hence it is called as Apache Tomcat. This tutorial shows how to install Apache Tomcat on respective Enterprise Linux with ease. Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation. It implements the Java Servlet, JavaServer Pages (JSP), Java Unified Expression Language and Java WebSocket specifications from Sun Microsystems and provides a web server environment for Java code to run in.
Related articles.
Downloads
Download the following software. The installation will work with either JDK7 or JDK8, so pick which you prefer. This article assumes these downloads are present in the '/tmp' directory on the server.
- Java SE Development Kit 7 Downloads (I used jdk-7u79-linux-x64.tar.gz)
- Java SE Development Kit 8 Downloads (I used jdk-8u77-linux-x64.tar.gz)
- Apache Tomcat (I used apache-tomcat-7.0.68.tar.gz)
Installation
Create a user called 'tomcat' to own the Tomcat installation.
Install the JDK (7 or 8) from the tarball under the tomcat user.
Install Tomcat from the tarball under the home directory of the 'tomcat' user.
Set the following environment variables and append them to the '/home/tomcat/.bash_profile' so they are set for subsequent logins. Remember to set the desired JAVA_HOME
correctly.
Start and stop Tomcat using the following scripts.
The Tomcat logs are written to the '$CATALINA_HOME/logs/' directory by default.
Once Tomcat is started, the following URL should be available. Configuration for the management URLs is discussed below.
Remember to open up the port on the firewall if you want to access the site from other servers on the network. Information about the Linux firewall is available here.
Checking the Status of Tomcat
There are several ways to check the status of the service.
The status is also available from the HTML management page.
Configuration Files
The main locations of configuration and log information are shown below.
Enabling HTML Management Access
Edit the '$CATALINA_HOME/conf/tomcat-users.xml' file, adding the following entries inside 'tomcat-users' tag. Adjust the password as required.
Restart Tomcat for the configuration to take effect.
The management application is now available from the 'http://localhost:8080/manager/html' URL.
Deploying Applications
You can get a sample application WAR file to test with from 'http://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/'.
If this is a redeployment, delete the existing deployment from the '$CATALINA_HOME/webapps' directory.
Place the 'sample.war' file in the '$CATALINA_HOME/webapps' directory and Tomcat with automatically deploy it. You will see a 'sample' directory appear.
You don't need to stop and start Tomcat for this to work, but you can if you want.
For more information see:
Hope this helps. Regards Tim...
Overview
Apache Tomcat is an open source J2EE Application Server. It is a top level project of the Apache foundation. Tomcat currently implements Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket.In this tutorial we'll learn to install Apache Tomcat 7 from scratch on Ubuntu 14.04. This tutorial assumes you have new clean base installation of Ubuntu 14.04
Updating Base System
First thing that we want to do to our base system is update the system to latest packages.
Installing JDK 8
Now, let's install Java Development Kit 8. We will use Oracle JDK instead of OpenJDK version of JDK 8.
Add the webupd8team ppa repository :
You need to press enter to continue adding the webupd8team PPA repository. The output above has been truncated to show you only the most important part.
Let apt-get download and read the metadata of the new repository that we just added:
Install JDK 8.
The -y
option above will make you agree automatically with packages to be installed including dependencies. If you want to check what packages will be installed you can remove the -y
option above.
Package configuration. Choose OK
Accepting Oracle Binary Code Lisence Terms. ChooseYes
After installing Java 8, you can check the current java version by running the command below :
We've confirmed that we already have JDK 8 installed.
Installing Apache Tomcat 7
To install Apache Tomcat 7 using apt-get
, you can use the command below :
Part of the installation output you might see :
If you try to start the service you will get a similar message.
Set JAVA_HOME Environment Variable
Let's check first where java is installed
From the output above we can see that the JAVA_HOME that we need is : /usr/lib/jvm/java-8-oracle/jre/
On /etc/default/tomcat7
, add JAVA_HOME on the last line :
Let's try starting the tomcat process again.
If the service started successfully, we can check from browser by going to http://<IP-ADDRESS:8080 or http://:8080. It should show something similar below :
Installing Tomcat Web Management
This step is optional since you can deploy a Java application to Tomcat even without a web management interface. To install Tomcat 7 Web Management you can use command below :
Configuring Apache Tomcat 7 Web Management User
Your Web Management is not ready yet, you need to configure the user for Tomcat 7 Web Management. Open /etc/tomcat7/tomcat-users.xml
:You can find the tomcat-users
block similar to below config blog.
Add the configuration below between and
above.
make sure you change tomcatadmin
and verysecretpassword
to your own preferred credentials.
Before you access the web management interface, you need to restart Tomcat 7 :
Let's try accessing the Tomcat Host Manager Application. You can click from the main page of Apache Tomcat but you can also access the Tomcat Web Application Manager directy from http://:8080/manager/html
There will be an authentication form pop up. You need to input your username and password that you already setup in /etc/tomcat7/tomcat-users.xml
After entering the correct username / password pair, you can see the Tomcat Host Manager Application
The host manager can be accessed fromhttp://<IP_ADDRESS:8080/host-manager/html
Configuring SSL
In this section we'll learn how-to configure Secure Socket Layer (SSL) on Tomcat 7.
Creating Keystore file using Java
We will use Java keytool
to generate a self signed certificate. You will need to enter a keystore password and some details regarding the certificate.
Apache Tomcat Installation Steps
$ sudo cp ~/.keystore /etc/tomcat7
$ sudo service tomcat7 restart
$ sudo apt-get install apache2
$ sudo a2enmod proxy$ sudo a2enmod proxy_http
Configure Apache Tomcat In Eclipse
$ sudo service apache2 restart
ProxyPass / http://127.0.0.1:8080/ProxyPassReverse / http://127.0.0.1:8080/
$ sudo service apache2 restart
Apache Tomcat Download
Summary
In this tutorial we learned how-to install Tomcat 7 from scratch, Installing JDK 8, Installung and configuring Tomcat 7 and also installing Tomcat Web Manager. We also setup Apache as a reverse proxy to proxy requests on port 80 to the Tomcat port. Now you can start deploying your Java application.