Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

2.0Tonmcat Advanced configuration and jDK installation configuration

2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

First, install JDK

1. Download

Wget http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-x64.tar.gz

2. Decompression and installation

[root@www src] # tar zxf jdk-8u65-linux-x64.tar.gz

[root@www src] # mv jdk1.8.0_65 / usr/local/

3. Set environment variables

[root@www src] # vim / etc/profile.d/java.sh

JAVA_HOME=/usr/local/jdk1.8.0_65

JAVA_BIN=/usr/local/jdk1.8.0_65/bin

JRE_HOME=/usr/local/jdk1.8.0_65/jre

PATH=$PATH:/usr/local/jdk1.8.0_65/bin:/usr/local/jdk1.8.0_65/jre/bin

CLASSPATH=/usr/local/jdk1.8.0_65/jre/lib:/usr/local/jdk1.8.0_65/lib:/usr/local/jdk1.8.0_65/jre/lib/charsets

.jar

4. Initialize

[root@www src] #. / etc/profile.d/java.sh / / same as source

[root@www src] # source / etc/profile.d/java.sh

[root@www src] # which java

/ usr/local/jdk1.8.0_65/bin/java

[root@www jdk1.8.0_65] # export PATH JAVA_HOME JAVA_BIN JRE_HOME CALSSPATH

5. View the version

[root@www src] # java-version

Java version "1.8.0mm 65"

Java (TM) SE Runtime Environment (build 1.8.0_65-b17)

Java HotSpot (TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

Second, install Tomcat

1. Download

[root@www src] # wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz

2. Decompression and installation

[root@www src] # tar zxf apache-tomcat-8.0.30.tar.gz

[root@www src] # mv apache-tomcat-8.0.30 / usr/local/tomcat

[root@www src] # ls / usr/local/tomcat/

Bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work

3. Copy the startup script

[root@www src] # cd / usr/local/tomcat/

[root@www tomcat] # cp-v bin/catalina.sh / etc/init.d/tomcat

`bin/catalina.sh'-> `/ etc/init.d/tomcat'

4. Set up boot boot

[root@www tomcat] # chmod 755 / etc/init.d/tomcat

[root@www tomcat] # chkconfig-- add tomcat

Service tomcat does not support chkconfig / / service does not support

Resolve:

[root@www tomcat] # vim / etc/init.d/tomcat / / add the following at the beginning

#! / bin/sh

# chkconfig: 2345 63 37

# description: tomcat server init script

# Source Function Library

. / etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.8.0_65

CATALINA_HOME=/usr/local/tomcat

[root@www tomcat] # chkconfig-- add tomcat

[root@www tomcat] # chkconfig tomcat on

5. Start Tomcat

[root@www jdk1.8.0_65] # / etc/init.d/tomcat start

Using CATALINA_BASE: / usr/local/tomcat

Using CATALINA_HOME: / usr/local/tomcat

Using CATALINA_TMPDIR: / usr/local/tomcat/temp

Using JRE_HOME: / usr/local/jdk1.8.0_65/jre

Using CLASSPATH: / usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

Tomcat started.

View tomcat processes

[root@www ~] # ps aux | grep tomcat

Root 3835 2.1 7.8 2722304 78704 pts/1 Sl 02:26 0:05 / usr/local/jdk1.8.0_65/jre/bin/java-Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager-Djava.endorsed.dirs=/usr/local/tomcat/endorsed-classpath / usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar-Dcatalina. Base=/usr/local/tomcat-Dcatalina.home=/usr/local/tomcat-Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start

Root 3867 0.0 103248 884 pts/1 S+ 02:30 0:00 grep tomcat

[root@www ~] # / etc/init.d/tomcat stop

[root@www ~] # / etc/init.d/tomcat start

6. Access testing

Enter http://192.168.1.21:8080 in the browser

III. Configuration and optimization of Tomcat

1. Modify the listening port

(1) stop the process of installing nginx to prevent port 80 from being occupied

[root@www ~] # / etc/init.d/nginx stop

Stopping Nginx: [OK]

[root@www ~] # chkconfig nginx off

(2) modify the tomcat listening port to 80

[root@www ~] # cd / usr/local/tomcat/conf/

[root@www conf] # ls

Catalina catalina.properties logging.properties tomcat-users.xml web.xml

Catalina.policy context.xml server.xml tomcat-users.xsd

[root@www conf] # vim server.xml

Find line 69

sixty-nine

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report