Install JDK and Tomcat in CentOS 64-bit and set the Tomcat Startup Procedure
The preparation file is as follows:
1. CentOS-6.4-x86_64-bin-DVD1.iso
2. jdk-7u67-linux-x64.rpm
3.apache-tomcat-7.0.55.tar.gz
The installation procedure is as follows:
1. Install JDK
[Root @ n1/] # java-version
Bash: java: command not found
[Root @ n1/] # rpm-ivh/soft/jdk-7u67-linux-x64.rpm.
Preparing... ######################################## ### [100%]
1: jdk ####################################### #### [100%]
Unpacking JAR files...
Rt. jar...
Jsse. jar...
Charsets. jar...
Tools. jar...
Localedata. jar...
Jfxrt. jar...
[Root @ n1/] #
[Root @ n1/] # java-version
Java version "1.7.0 _ 67"
Java (TM) SE Runtime Environment (build 1.7.0 _ 67-b01)
Java HotSpot (TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
[Root @ n1/] # cd/usr/java
[Root @ n1 java] # ls
Default jdk1.7.0 _ 67 latest
[Root @ n1 java] #
Ii. install Tomcat
Rm-rf/usr/local/tomcat7
Cd/usr
Cd/usr/local/tomcat7
Ls
Ls
Cd/
Tar zxvf/soft/apache-tomcat-7.0.55.tar.gz
Mv/apache-tomcat-7.0.55/usr/local/tomcat7
Chmod + x/usr/local/tomcat7
3. Set Environment Variables
Run the vim/etc/profile command and add the environment variable Code as follows:
# Jdk config
Export JAVA_HOME =/usr/java/jdk1.7.0 _ 67
Export CALSSPATH = $ JAVA_HOME/lib /*.*
# Tomcat config
Export TOMCAT_HOME =/usr/local/tomcat7
Export CATALINA_HOME =/usr/local/tomcat7
# Path config
Export PATH = $ PATH: $ JAVA_HOME/bin: $ TOMCAT_HOME/bin
Execute Command source/etc/profile to refresh environment variable
4. start Tomcat
Sh/usr/local/tomcat7/bin/startup. sh
Open the URL http: // localhost: 8080 in Firefox to test
Disable Tomcat commands
Sh/usr/local/tomcat7/bin/shutdown. sh
V. start Tomcat script upon startup
5.1 run the command vi/etc/rc. d/init. d/tomcat to generate the script file. The content is as follows:
#! /Bin/bash
#
#/Etc/rc. d/init. d/tomcat
# Init script for tomcat precesses
#
# Processname: tomcat
# Description: tomcat is a j2se server
# Chkconfig: 2345 86 16
# Description: Start up the Tomcat servlet engine.
If [-f/etc/init. d/functions]; then
./Etc/init. d/functions
Elif [-f/etc/rc. d/init. d/functions]; then
./Etc/rc. d/init. d/functions
Else
Echo-e "\ atomcat: unable to locate functions lib. Cannot continue ."
Exit-1
Fi
RETVAL =$?
CATALINA_HOME = "/usr/local/tomcat7" # tomcat installation directory
Case "$1" in
Start)
If [-f $ CATALINA_HOME/bin/startup. sh];
Then
Echo $ "Starting Tomcat"
$ CATALINA_HOME/bin/startup. sh
Fi
;;
Stop)
If [-f $ CATALINA_HOME/bin/shutdown. sh];
Then
Echo $ "Stopping Tomcat"
$ CATALINA_HOME/bin/shutdown. sh
Fi
;;
*)
Echo $ "Usage: $0 {start | stop }"
Exit 1
;;
Esac
Exit $ RETVAL
5.2 Add the chmod 755/etc/rc. d/init. d/tomcat permission to make the script file executable
5.3 run: chkconfig -- add/etc/rc. d/init. d/tomcat # add it to the service
5.4 Add the following statement to the vim/usr/local/tomcat7/bin/catalina. sh file:
# Auto startup tomcat config
Export JAVA_HOME =/usr/java/jdk1.7.0 _ 67
Export CATALINA_HOME =/usr/local/tomcat7
Export CATALINA_BASE =/usr/local/tomcat7
Export CATALINA_TMPDIR =/usr/local/tomcat7/temp
Start tomcat service: service tomcat start
Stop tomcat service: service tomcat stop
Load Balancing between Apache and multiple Tomcat clusters in Linux
Nginx Tomcat Cluster load balancing solution notes
Instance details Tomcat component installation + Nginx reverse proxy Tomcat + Apache use mod_jk and mod_proxy Reverse Proxy and load balancing
Deploy a log server using Rsyslog + LogAnalyzer + MySQL in CentOS 6.5
Build an Apache + Tomcat environment (JK deployment process)
Tomcat details: click here
Tomcat: click here
This article permanently updates the link address: