1. Install JDK and Tomcat installation directory for/usr/local/apache-tomcat-8.0.52 steps
2. Create a user tomcat and set it to not be logged on
Its command #useradd-s/usr/sbin/nologin Tomcat
3. Install and compile the daemon service
3.1 Switching directories into the Tomcatbin directory #cd/usr/local/apache-tomcat-8.0.52/bin/
3.2 Extract the daemon file #tar-xzvf commons-daemon-native.tar.gz
3.3 Enter the installation path #cd commons-daemon-1.0.15-native-src/unix/
3.4 Installation #./configure
3.5 Compiling # Make
3.6 Copying compiled files
When you do make, a jsvc file is generated and copied to the Tomcat bin directory CP Jsvc/usr/local/apache-tomcat-8.0.52/bin
4. Modify the startup script
Command #vi/usr/local/apache-tomcat-8.0.52/daemon.sh
Find the following:
Test ". $TOMCAT _user" =. && Tomcat_user=tomcat
Set Java_home to working JDK or jrejava_home=/opt/jdk-1.6.0.22
Modify Tomcat_user=tomcat, "Tomcat" is the user who is running Tomcat, the user created by this article is Tomcat, so there is no need to modify it.
Remove the comment (that is, "#") before Java_home and set it to the directory where the JDK is located (/opt/jdk_1.7).
5. Change the Tomcat directory permissions
5.1 Giving users the right to execute
chmod a+x/opt/tomcat8/bin/daemon.sh
5.2 Modifying the user owner of logs temp work conf
Chown Tomcat Logs
Chown Tomcat Temp
Chown Tomcat Work
Chown Tomcat conf
Modify the user owner of the file inside the Conf
Chown Tomcat conf/*
6. Speed up Tomcat boot
Open the $java_path/jre/lib/security/java.security file and find the following:
Securerandom.source=file:/dev/urandom (or Securerandom.source=file:/dev/random) replaced with securerandom.source=file:/dev/ ./urandom
Lucky 28 Platform Rental vs. Linux non-root