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 build a Tomcat9 environment for CentOS

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I would like to share with you the relevant knowledge about how to build a Tomcat9 environment in CentOS. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Tomcat server is a free and open source Web application server, which is a lightweight application server. It is widely used in small and medium-sized systems and not many concurrent access users. It is the first choice for developing and debugging JSP programs.

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!

[in this way, if you go directly to the bin directory under the apache-tomcat folder and run tomcat, there will be a problem: once the reboot server is restarted, tomcat will be shut down.]

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

[root@izuf6famz0x92jd98na1kiz /] # cp / usr/local/tomcat/apache-tomcat-9.0.10/bin/catalina.sh / etc/init.d/tomcatshell~#cp / usr/local/apache-tomcat/bin/catalina.sh / etc/init.d/tomcat Edit this file [root@izuf6famz0x92jd98na1kiz /] # cd / etc/init.d [root@izuf6famz0x92jd98na1kiz init.d] # lsaegis agentwatch functions netconsole network README tomcat [root@izuf6famz0x92jd98na1kiz init.d] # vi tomcatshell~#vi tomcat under #! / bin/sh Enter # 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 the environment variable JAVA_HOME=/usr/java/jdk1.7.0_07export JAVA_HOMEPATH=$JAVA_HOME/bin:$PATHexport PATHCATALINA_HOME=/usr/local/apache-tomcat under the split line to give the script and permission shell~#chmod 755 tomcat add tomcat service here use chkconfigshell~#chkconfig-- add tomcat if there is a prompt here insserv: warning: script 'tomcat' missing LSB tags and overridesinsserv: There is a loop between service nginx and tomcat if stoppedinsserv: loop involving service tomcat at depth 2insserv: loop involving service nginx at depth 1insserv: Stopping tomcat depends on nginx and therefore on system facility `$all' which can not be trueactuinsserv: exiting now without changing boot order! Then you need to install the chkconfig installation method shell~#apt-get install chkconfig, if the following indicates success, or you can enter the following command to check shell~#chkconfig-- list tomcattomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off if 345 is closed. Execute the following command to set tomcat to boot. Shell~# chkconfig tomcat on start and see 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~# service tomcat stopshell~# service tomcat restart above is all the content of this article "how to build a Tomcat9 environment for CentOS". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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

Development

Wechat

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

12
Report