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

How to install Tomcat9 in CentOS

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Today, I will talk to you about how to install Tomcat9 in CentOS. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

1. Download Tomcat

Deploy to / usr/local/tomcat and create folders and directories.

Use the wget directive:

Wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-9/v9.0.10/bin/apache-tomcat-9.0.10.tar.gz

The result is as follows: apache-tomcat-9.0.10.tar.gz was downloaded successfully.

2. Decompress

Tar-zxvf apache-tomcat-9.0.10.tar.gz

Automatic decompression

3. Start tomcat

Enter the bin directory under tomcat

[root@izuf6famz0x92jd98na1kiz bin] #. / catalina.sh start

Discover tomcat started

4. Access through the browser

After searching and querying, it may be Ali CVM. Due to the security requirements, it is impossible to directly access:

Solution:

(1) enter the Ali CVM console, security group, as shown in the figure below, and click configure rules.

(2) configure rules and add rules to allow any IP to access 8080

(3) if you visit again, you will succeed.

Download and install the tomcat server successfully!

5. Tomcat configuration service and self-startup (optional, can not be set)

Add tomcat to the service, go to tomcat's bin directory, copy catalina.sh to / etc/init.d and name it tomcat

Shell~#cp / usr/local/apache-tomcat/bin/catalina.sh / etc/init.d/tomcat

Edit this file

Shell~#vi tomcat

Join under #! / bin/sh

# BEGIN INIT INFO# Provides: tomcat# Required-Start: $remote_fs $network# Required-Stop: $remote_fs $network# Default-Start: 23 4 "Default-Stop: 0 1" Short-Description: The tomcat Java Application Server### END INIT INFO

Add environment variables under the dividing line

JAVA_HOME=/usr/java/jdk1.7.0_07export JAVA_HOMEPATH=$JAVA_HOME/bin:$PATHexport PATHCATALINA_HOME=/usr/local/apache-tomcat

Give this script and permissions

Shell~#chmod 755 tomcat

Add a tomcat service here using chkconfig

Shell~#chkconfig-add tomcat

If there is a hint here

Insserv: warning: script 'tomcat' missing LSB tags and overrides

Insserv: There is a loop between service nginx and tomcat if stopped

Insserv: loop involving service tomcat at depth 2

Insserv: loop involving service nginx at depth 1

Insserv: Stopping tomcat depends on nginx and therefore on system facility `$ all' which can not be true!

Insserv: exiting now without changing boot order!

Then you need to install the chkconfig installation method

Shell~#apt-get install chkconfig

Success can be indicated by the following

Tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off

You can also check it out by entering the following command

Shell~#chkconfig-list tomcat

Tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off

If 345 is off. Execute the following command to set tomcat to boot.

Shell~# chkconfig tomcat on

Start it and have a look.

Shell~# service tomcat startUsing CATALINA_BASE: / usr/local/apache-tomcatUsing CATALINA_HOME: / usr/local/apache-tomcatUsing CATALINA_TMPDIR: / usr/local/apache-tomcat/tempUsing JRE_HOME: / usr/java/jdk1.7.0_07Using CLASSPATH: / usr/local/apache-tomcat/bin/bootstrap.jar:/usr/local/apache-tomcat/bin/tomcat-juli.jar

Start, stop, restart

Shell~# service tomcat startshell~# ervice tomcat stopshell~# service tomcat restart after reading the above, do you have any further understanding of how to install Tomcat9 in CentOS? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Servers

Wechat

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

12
Report