Detailed explanation of the operation of installing and starting tomcat through the Linux system of the virtual machine

1. Install JDK

        Install JDK with yum

        1. Check which jdk versions are in the yum library

              命令:yum search java|grep jdk


              [root@localhost webapps]# yum search java|grep jdk
ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-debug.x86_64 : OpenJDK Runtime Environment with full debug on
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-demo-debug.x86_64 : OpenJDK Demos with full debug on
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-devel-debug.x86_64 : OpenJDK Development Environment with
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-headless-debug.x86_64 : OpenJDK Runtime Environment with full
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-javadoc-debug.noarch : OpenJDK API Documentation for packages
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk-src-debug.x86_64 : OpenJDK Source Bundle for packages with

ldapjdk.x86_64 : The Mozilla LDAP Java SDK

2. Select the version to install
 
//Select the 1.7 version to install
[root@localhost ~]# yum install java-1.7.0-openjdk

//After installation, the default installation directory is: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64


3. Set environment variables
 
[root@localhost ~]# vi /etc/profile
 
Add the following content to the profile file
 
#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
 
makes the modification take effect
[root@localhost java]# source /etc/profile

4. Verify the validity of the JDK 

[root@localhost java]# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

2. Install Tomcat

1. Upload the tomcat file to the system


2. Configure the environment variables and memory settings of tomcat

     Go to the bin directory of tomcat and open the catalina.sh    file.



Add the marked code as shown in the figure.

JAVA_OPTS="-Xms512m -Xmx1024m -Xss1024k -XX:PermSize=512m -XX:MaxPermSize=1024m"
export TOMCAT_HOME=/home/ty910102/yohey/tomcat/apache-tomcat-6.0.20
export CATALINA_HOME=/home/ty910102/yohey/tomcat/apache-tomcat-6.0.20
export JRE_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171.x86_64/jre

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.171.x86_64

3. Modify the tomcat port number, enter the conf directory of tomcat, and modify the server.xml file




4. Try to start tomcat

       Switch to the directory path of tomcat and enter "bin/startup.sh"


Once done, enter " http://localhost:8081/ " in your browser




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324524292&siteId=291194637