In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Introduction to jsvc
In production, tomcat should run in daemon mode, and if you need to start tomcat as an ordinary user, you cannot use ports less than 1024, which is the limitation of the Liunx system. Only root users can use ports less than 1024. So how do you configure tomcat as a service? We can easily encapsulate our own startup script through jsvc, and we can also make tomcat run users and groups at will, and we can also specify jvm running parameters such as memory control, language, character encoding. We can also specify that tomcat starts yes pidfile. In short, we can have finer control over how tomcat works. It has an incomparable advantage over the original script.
Okay! After blowing so much, this article just wants to operate how to use ordinary users to run, the rest I haven't learned yet!
Set the permissions of the Tomcat directory
Create tomcat users (also create tomcat groups by default)
Useradd tomcat
Set the primary user of the tomcat directory to tomcat and the subordinate group to the tomcat group
Chown-R tomcat:tomcat / usr/local/tomcat/enter description here
The tomcat root permission displayed at this time actually means that the soft link belongs to root. The tomcat directory we linked already belongs to tomcat and-R recursively passes the permission.
Open the readable permissions of all files under the tomcat to the users in the group to avoid starting the Times error. For example, cannot read sever.xml file
Chmod-R galler tomcat/
Open the writable permissions of the webapps,logs,work,temp directory under tomcat to the users in the group
Chmod-R Grouw logs/ temp/ webapps/ work/
Install jsvc
I talked about deploying a Java+Tomcat environment last time, and this article is a follow-up to the last time.
Attached is the previous article: https://www.jb51.net/article/160936.htm
Jsvc binds to the tomcat binary distribution, finds the source package, and prepares it for compilation into binaries.
Go to the bin directory under tomcat and find commons-daemon-native.tar.gz
Enter description here
Decompress the source code package
Tar-zxvf commons-daemon-native.tar.gz
Go to the extracted directory and compile
Cd commons-daemon-1.0.15-native-src/unix
. / configure-- with-java=$JAVA_HOME
Enter description here
The above error is that the gcc compilation environment is not installed.
Yum install gcc-c++-y
Run it again and the following will be fine.
Enter description here
Compile
Make
When the compilation is complete, a jsvc file is generated in the current folder
Enter description here
Copy it to the tomcat bin directory
Cp jsvc / usr/local/tomcat/bin/
Then we use daemon.sh to run our tomcat.
. / daemon.sh start
Other commands:
. / daemon.sh stop
Summary
The above is the editor to introduce to you the use of jsvc to start tomcat (use ordinary users to run, hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
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.