Tomcat is developed for Java and requires the JDK environment to be deployed first
1 , deploy JDK
Mkdir/application/jdk-1.8.162-p
cd/application/jdk-1.8.162
Download or upload a JDK source package
Tar XF jdk-8u162-linux-x64.tar.gz
Cp-a jdk1.8.0_162/*./
RM-RF jdk1.8.0_162
Ln-s JDK-1.8.162/JDK
echo ' Export java_home= '/application/jdk ' >>/etc/profile
echo ' Export jre_home= '/application/jdk/jre ' >>/etc/profile
echo ' Export classpath= ' ${java_home}/lib:${java_home}/jre/lib ' >>/etc/profile
echo ' Export path= ' ${java_home}/bin:${jre_home}/bin:${path} ' >>/etc/profile
Source/etc/profile
[Email protected] jdk]# java-version
Java Version "1.8.0_162"
Java (TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot (TM) 64-bit Server VM (build 25.162-b12, Mixed mode)
JDK Installation Complete
2 , deploy Tomcat :
mkdir/application/tomcat-8.0
cd/application/tomcat-8.0
Download or upload the Tomcat source package
Tar XF apache-tomcat-8.0.48.tar.gz
Cp-ar apache-tomcat-8.0.48/*./
Ln-s Tomcat-8.0/tomcat
echo ' Export catalina_home= '/application/tomcat ' >>/etc/profile
echo ' Export catalina_base= '/application/tomcat ' >>/etc/profile
echo ' Export path= ' ${catalina_home}/bin:${path} ' >>/etc/profile
Source/etc/profile
Here's the tomcat start-and-stop script:
Cat >>/etc/init.d/tomcat<<end
#!/bin/bash
#description: Tomcat Start Stop Restart
# PROCESSNAME:TOMCAT8
#chkconfig: 234 30 80
Catalina_home=/application/tomcat
Case \$1 in
Start
SH \ $CATALINA _home/bin/startup.sh
;;
Stop
SH \ $CATALINA _home/bin/shutdown.sh
;;
Restart
SH \ $CATALINA _home/bin/shutdown.sh
Sleep 2
SH \ $CATALINA _home/bin/startup.sh
;;
*)
Echo ' please use:tomcat {start | stop | restart} '
;;
Esac
Exit 0
End
/etc/init.d/tomcat start
Chkconfig--add Tomcat
Chkconfig--list|grep Tomcat
Enter ip:8080 in the browser if the Tomcat interface indicates that the installation was successful
You can also use catalina.sh start or start.up in the/application/tomcat/bin directory to start Tomcat, using Catalina stop or shutdown.sh to shut down the Tomcat service
Note: The catalina.sh script is powerful and uses--help to see how to use Help
(1) Deploying JDK and Tomcat