Complete Guide to installing Apache Tomcat on Linux

Source: Internet
Author: User

Complete Guide to installing Apache Tomcat on Linux

Apache Tomcat, also known as Tomcat server, is an open-source java servlet cotainer & provides a pure JAVA http webserver environmnet to run java code. This is a well-known and widely used Java-based website across the world. Apache Tomcat provides a large number of key task Web applications for many industries and organizations.

Apache Tomcat can be used in various operating systems, such as Linux, Unix, and Windows. Apache Tomcat recently announced the end of Tomcat 8.0.x, although this does not affect version 8.5.x.

In this tutorial, we will discuss how to install Apache Tomcat in v8.5, because it is the latest stable version (v9 is also available and is still in BETA when writing this article, and there is no stable version currently ).

Prerequisites

To install Tomcat 8.5, we need JAVA 7 or later. So first we need to install and set JAVA on our system. You can use the following command to install JAVA,

CentOS/RHEL
$ Sudo yum install java-1.8.0

Ubuntu/Debian
$ Sudo apt-get install openjdk-8 *

For more information, see our detailed article "how to install JAVA 7 and 8 on Linux.

Install Apache Tomcat

For Apache Tomcat installation, we will use the following command to download archived software packages from the official website,

$ Wget http://redrockdigimark.com/apachemirror/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz

Once the file is downloaded, decompress the package in the/opt directory (we can also use some other directories/data ). Run the following command on the terminal to Extract files,

$ Tar-xvzf pache-tomcat-8.5.23.tar.gz-C/opt

$ Mv/opt/apache-tomcat-8.5.23 // opt/tomcat

Apache Tomcat is now ready, but before doing so, we need to assign a certificate to access tomcat's 'manager' and 'GU' pages. By default, no user name or password is set. To verify the credential, we will use the '/opt/tomcat/conf/tomcat-users.xml' file,

$ Vim/opt/tomcat/conf/tomcat-users.xml

Enter the following information for the file,

<Role rolename = "manager-gui"/>

<User username = "manager" password = "Password @ 123" roles = "manager-gui"/>

<Role rolename = "admin-gui"/>

<User username = "admin" password = "Password @ 123" roles = "admin-gui"/>

Make sure that you make these inputs before the label "tomcat-users", that is, before the rows mentioned below,

<Tomcat-users xmlns = "http://tomcat.apache.org/xml"

Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"

Xsi: schemaLocation = "http://tomcat.apache.org/xml tomcat-users.xsd"

Version = "1.0">

Save the file and exit.

We need to make another change, although this is completely optional, depending entirely on how you access the Manager page. We can only manage the page from a browser on the browser, but we want to modify the page on another remote machine. for manager, comment out the lines that Disable remote logon,

$ Vi/opt/tomcat/webapps/manager/META-INF/context. xml

<Context antiResourceLocking = "false" privileged = "true">

<! -<Valve className = "org. apache. catalina. valves. RemoteAddrValve"

Allow = "127 \. \ d + \. \ d + \. \ d + |: 1 | 0: 0: 0: 0: 0: 0: 0: 1 "/>->

</Context>

It also applies to the context file of host-manager,

$ Vi/opt/tomcat/webapps/host-manager/META-INF/context. xml

<Context antiResourceLocking = "false" privileged = "true">
<! -<Valve className = "org. apache. catalina. valves. RemoteAddrValve"
Allow = "127 \. \ d + \. \ d + \. \ d + |: 1 | 0: 0: 0: 0: 0: 0: 0: 1 "/>->
</Context>

Now we are going to start the tomcat server, go to the/opt/tomcat/bin folder, and run the script "startup. sh,

$ Cd/opt/tomcat/bin

$ Sh startup. sh

Apache Tomcat starts the following output,

Open the Web browser you selected and use the following URL to access the Apache Tomcat UI,

Http: // 192.168.1.100: 8080

 

Here, 192.168.1.100 is the IP address of the apache tomcat server. We will now be directed to the following page,

On this page, we can click the corresponding tag to access the "Manager" and "Host Manager" pages. After clicking any tag, we will be asked to perform authentication to access this page. We need to enter the creden for accessing the page we set earlier,

For more Tomcat tutorials, see the following:

Install and configure the Tomcat environment in CentOS 6.6

Install JDK + Tomcat in RedHat Linux 5.5 and deploy Java Projects

Tomcat authoritative guide (second edition) (Chinese/English hd pdf + bookmarks)

Tomcat Security Configuration and Performance Optimization

How to Use Xshell to view Tomcat real-time logs with Chinese garbled characters in Linux

Install JDK and Tomcat in CentOS 64-bit and set the Tomcat Startup Procedure

Install Tomcat 8.5.9 in Ubuntu 16.04

Diagram of installing Tomcat 8 on Ubuntu 16.04

Tomcat configuration file server. xml

Single-host and multi-instance deployment of Tomcat-multi-project deployment

Tomcat details: click here
Tomcat: click here

Now, we will end the tutorial on how to install Tomcat or Apache Tomcat 8.5 on CentOS/RHEL & Ubuntu/Debain. Please use the comment box below to send your thoughts or suggestions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.