In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Introduction of Tomcat
The origin of the name: Tomcat was originally developed by James Duncan Davidson, a software architect at Sun (Baidu for details). Tomcat server is a free and open source Web application server, which is a lightweight application server. It is used in small and medium-sized systems and where concurrent access is not many.
II. Deployment and implementation
1. Implementation environment
Host operating system IP address main software Tomcat server CentOS-7-x86_64
192.168.1.10
Jdk-7u65-linux-x64.gz
Apache-tomcat-7.0.54.tar.gz
two。 Implementation preparation
JDK must be installed before Tomcat can be installed. JDK, whose full name is Java Development Kit, is a free Java language software development kit provided by Sun, which includes Java Virtual Machine (JVM). The written Java source program can be compiled to form Java bytecode. As long as you install JDK, you can use JVM to interpret these byte files, thus ensuring the cross-platform nature of Java. In terms of platform compatibility, JDK, as a Java virtual machine that interprets bytecode files and calls operating system API to implement application functions, is closely related to the type of operating system and the number of platform bits, so there are different versions, and Tomcat also has the above characteristics, so you need to download JDK and Tomcat first. The versions of this software are as follows:
JDK:jdk-7u65-linux-x64.gz
Tomcat:apache-tomcat-7.0.54.tar.gz
3. Install JDK and configure the java environment
(1) decompress jdk-7u65-linux-x64.gz.
[root@localhost ~] # tar xf jdk-7u65-linux-x64.gz
(2) after decompression, the jdk1.7.0_65 folder will be moved to / usr/local/ and renamed to java (the / usr/local directory mainly stores some packages installed through the source code package, similar to program files under WINDOWS).
[root@localhost ~] # mv jdk1.7.0_65/ / usr/local/java
(3) create a java.sh script () under / etc/profile.d/.
[root@localhost ~] # vim / etc/profile.d/java.sh
Export JAVA_HOME=/usr/local/java / / set the Java root directory
Export PATH=$PATH:$JAVA_HOME/bin / / add the / bin subdirectory of the Java root directory to the PATH environment variable
(4) Import the java.sh script into the environment variable to make it effective.
[root@localhost ~] # source / etc/profile.d/java.sh
(5) run the java-version command or the javac-version command to see if the Java version is the same as previously installed.
[root@localhost ~] # java-version
Java version "1.7.0,65"
Java (TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot (TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Or
[root@localhost ~] # javac-version
Javac 1.7.0_65
At this point the Java environment has been configured.
4. Install and configure Tomcat
(1) decompress the apache-tomcat-7.0.54.tar.gz package.
[root@localhost ~] # tar xf apache-tomcat-7.0.54.tar.gz
(2) generate an apache-tomcat-7.0.54 folder after decompression, move the folder to / usr/local/, and rename it to tomcat7.
[root@localhost ~] # mv apache-tomcat-7.0.54 / usr/local/tomcat7
(3) start tomcat
[root@localhost ~] # / usr/local/tomcat7/bin/startup.sh
Using CATALINA_BASE: / usr/local/tomcat7
Using CATALINA_HOME: / usr/local/tomcat7
Using CATALINA_TMPDIR: / usr/local/tomcat7/temp
Using JRE_HOME: / usr/local/java
Using CLASSPATH: / usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
Tomcat started.
Close tomcat
[root@localhost conf] # / usr/local/tomcat7/bin/shutdown.sh
Using CATALINA_BASE: / usr/local/tomcat7
Using CATALINA_HOME: / usr/local/tomcat7
Using CATALINA_TMPDIR: / usr/local/tomcat7/temp
Using JRE_HOME: / usr/local/java
Using CLASSPATH: / usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
/ usr/local/tomcat7/bin/catalina.sh: line 437: / usr/local/java/bin/java: cannot execute binary file
Tomcat runs on port 8080 by default. Run the netstat command to view the listening information on port 8080.
[root@localhost ~] # netstat-anpt | grep 8080
Tcp6 0 0: 8080: * LISTEN 2328/java Port 8080 needs to be opened because the firewall is enabled
[root@localhost] # iptables-I INPUT-p tcp-m multiport-- dport 8080-j ACCEPT
[root@localhost] # iptables-I INPUT-p tcp-m state-- state ESTABLISHED-j ACCEPT
[root@localhost ~] # iptables-p INPUT DROP
Iptables v1.4.21: unknown protocol "input" specified
Try `iptables-h' or 'iptables-- help' for more information.
III. Instructions on Tomcat configuration
The home directory of Tomcat is / usr/local/tomca7/.
Home directory description
|-bin/: stores script files for starting and shutting down Tomcat on windows or linux platforms.
|-conf/: stores various global configuration files of tomcat server, the most important of which are server.xml and web.xml.
|-lib/: stores the library files (JARS) needed for tomcat operation.
|-logs/: stores the LOG file when Tomcat executes.
|-webapps/:Tomcat 's main Web publishing directory.
|-work/: stores the class file generated by jsp compilation.
Profile description
Server.xml: the main configuration file. By changing this file, you can modify the startup port of Tomcat, website directory, virtual host, open https and other important functions.
Catalina.policy: permission control profile.
Catalina.properties:tomcat property profile.
Logging.propertiess: log log related configuration files.
Tomcat-users.xml:manager-gui manages user profiles (after tomcat installation, it provides an administrative interface for manager-gui, through which configuration can enable access).
Servlet, servlet-mapping, filter, MIME and other related configurations of web.xml:Tomcat.
Extended understanding: main profile server component description
The whole server.xml consists of the following structures:,.
Come on, boy, don't let your wishes turn into regrets.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.