In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to install tomcat9 in Centos7 and set up automatic startup? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
What is Tomcat?
Tomcat is a Servlet container developed by the Jakarta project under the Apache Software Foundation. According to the technical specifications provided by Sun Microsystems, it supports Servlet and JavaServer Page (JSP), and provides some unique functions as a Web server, such as Tomcat management and control platform, security domain management and Tomcat valve. Because Tomcat itself contains a HTTP server, it can also be considered a separate Web server. However, you can't confuse Tomcat with an Apache HTTP server, which is a HTTPWeb server implemented in C; the two HTTP web server are not bundled together. Apache Tomcat includes a configuration management tool, which can also be configured by editing a configuration file in XML format.
1. Download the installation package on the official website
Select the installation package suitable for Linux, download it locally and upload it to the centos server, or download it directly through the wget command
# cd / usr/local/# mkdir tomcat/# cd tomcat/# wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-9/v9.0.0.M11/bin/apache-tomcat-9.0.0.M11.tar.gz
By doing the above, download the tomcat9 installation package file apache-tomcat-9.0.0.M11.tar.gz to the / usr/local/tomcat directory
2. Install tomcat9
# cd / usr/local/tomcat# tar-zxvf apache-tomcat-9.0.0.M11.tar.gz
The installation package will be unzipped to / usr/local/tomcat/apache-tomcat-9.0.0.M11 and the directory will be renamed tomcat9
# mv / usr/local/tomcat/apache-tomcat-9.0.0.M11 / usr/local/tomcat/tomcat9
Configure the tomcat9 startup environment
# vi / etc/profile.d/tomcat9.shexport CATALINA_HOME=/usr/local/tomcat9export PATH=$TOMCAT_HOME/bin:$PATH# source / etc/profile.d/tomcat9.sh
Use systemd to manage tomcat9 services
# cat / usr/lib/systemd/system/tomcat9.service [Unit] Description=Apache Tomcat 9After=syslog.target network.target remote-fs.target nss- lookup.target [service] Type=forkingPIDFile=/usr/local/tomcat9/tomcat9.pidExecStart=/usr/local/tomcat9/bin/catalina.sh start-DEFOREGRANDExecReload=/bin/kill-s HUP $MAINPIDExecStop=/bin/kill-s QUIT $MAINPIDRemainAfterExit= ys [install] WantedBy=multi-user.target
3. Configure tomcat9 to boot
Add the tomcat9.service file to the / usr/lib/systemd/system directory as follows:
[Unit] Description=TomcatAfter=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=oneshotExecStart=/usr/local/tomcat/tomcat9/bin/startup.shExecStop=/usr/local/tomcat/tomcat9/bin/shutdown.shExecReload=/bin/kill-s HUP $MAINPIDRemainAfterExit=yes [Install] WantedBy=multi-user.target
Exit and save, execute systemctl enable tomcat to enable tomcat9 to start with boot
# systemctl enable tomcat9.service
Additional orders
Systemctl start tomcat9.service starts tomcat
Systemctl stop tomcat9.service shuts down tomcat
Systemctl restart tomcat9.service restart tomcat
Of course, starting and ending tomcat can also be done by executing shutdown.sh startup.sh under the bin directory of tomcat's installation directory.
4. Verify that the installation is successful
Enter http:// server IP:8080/
If a familiar tomcat home page appears, it means that the installation is successful. Please make sure that the server port 8080 has been released.
After reading the above, have you mastered how to install tomcat9 in Centos7 and set up automatic startup? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.