Tomcat installation and configuration on RedHat, tomcatredhat Configuration

Source: Internet
Author: User

Tomcat installation and configuration on RedHat, tomcatredhat Configuration

1. Uninstall the Tomcat version that comes with the System

1. Comment out or delete Tomcat environment variables:

Vi/etc/profile
# Export CATALINA_HOME = $ JAVA_HOME;/usr/apache-tomcat-6.0.26
2. delete an object

Rm-rf/usr/apache-tomcat-6.0.26

 

Ii. install Tomcat

First download the installation package to the Apache official website, the latest installation package link: http://tomcat.apache.org/download-70.cgi

The following uses the latest apache-tomcat-7.0.27 version as an example to install it:

A. Unzip: # tar-zxvf apache-tomcat-7.0.27.tar.gz

B. Copy and rename the folder: # cp-R apache-tomcat-7.0.27/usr/local/tomcat

C. start Tomcat:/usr/local/tomcat/bin/startup. sh

D. See the following information:

Using CATALINA_BASE:/usr/local/tomcat
Using CATALINA_HOME:/usr/local/tomcat
Using CATALINA_TMPDIR:/usr/local/tomcat/temp
Using JRE_HOME:/usr/java/jdk1.7.0 _ 04
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap. jar:/usr/local/tomcat/bin/tomcat-juli.jar
E. Use a browser to access http: // localhost: 8080. The default tomcat page is displayed.

 

3. Configure Environment Variables

Modify the/etc/profile file and add the following content at the end of the file:

TOMCAT_HOME =/usr/local/tomcat
Export TOMCAT_HOME

 

4. configure remote access
By default, the firewall in Linux prohibits access to port 8080.

We can disable the firewall or open the firewall to access port 8080.

1. Disable the firewall: # service iptables stop

2. Open access to port 8080 through the firewall:

A. modify the/etc/sysconfig/iptables file and add the following line: -A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 8080-j ACCEPT (required in "-A RH-Firewall-1-INPUT-j REJECT -- reject-with icmp-host-prohibited ).

B. restart the firewall: # service iptables restart

 

5. Enable user name and password

In tomcat 7 free installation version, the user name and password are not enabled by default, We need to manually specify in the tomcat-users.xml file (in the conf folder ), some account information has been written in this file, but the comments are used by default. After the comments are canceled, the user name and password provided in this file are used for access, "403 Access Denied" error may occur. This is because we do not specify the user's permissions. For example, we want to Access the graphical management application function in tomcat, that is, the Manager App, to access the host manager, you must specify the admin-gui permission. Below is an available tomcat-users.xml file.

<Role rolename = "admin-gui"/>
<Role rolename = "manager-gui"/>
<User username = "tomcat" password = "tomcat" roles = "manager-gui, admin-gui"/>

The following permissions are optional.

<Role rolename = "admin"/>
<Role rolename = "standard"/>
<Role rolename = "manager"/>
<User username = "admin" password = "admin" roles = "standard, manager, admin"/>

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.