Linux配置Tomcat步骤mv apache-tomcat-7.0.82 tomcat

时间:2021-10-24 16:51:19

(一)安装JAVA
1、检查java环境 java -version,不存在安装。
2、yum -y list java*

Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Installed Packages
javapackages-tools.noarch 3.4.1-11.1.al7 @base
Available Packages
java-1.6.0-openjdk.x86_64 1:1.6.0.40-1.13.12.9.4.al7 base
java-1.6.0-openjdk-demo.x86_64 1:1.6.0.40-1.13.12.9.4.al7 base
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.40-1.13.12.9.4.al7 base
java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.40-1.13.12.9.4.al7 base
java-1.6.0-openjdk-src.x86_64 1:1.6.0.40-1.13.12.9.4.al7 base
java-1.7.0-openjdk.x86_64 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.7.0-openjdk-accessibility.x86_64 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.7.0-openjdk-demo.x86_64 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.7.0-openjdk-headless.x86_64 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.7.0-openjdk-src.x86_64 1:1.7.0.121-2.6.8.0.1.al7 updates
java-1.8.0-openjdk.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-accessibility-debug.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-debug.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-demo.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.102-4.b14.4.al7 base
java-1.8.0-openjdk-javadoc-zip-debug.noarch 1:1.8.0.102-4.b14.4.al7 base
java-1.8.0-openjdk-src.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.111-1.b15.2.al7 updates
java-atk-wrapper.i686 0.30.4-5.1.al7 base
java-atk-wrapper.x86_64 0.30.4-5.1.al7 base
java-dirq.noarch 1.8-1.el7 epel
java-dirq-javadoc.noarch 1.8-1.el7 epel
java-oauth.noarch 20100601-13.el7 epel
java-oauth-javadoc.noarch 20100601-13.el7 epel
java_cup.noarch 1:0.11a-16.1.al7 base
java_cup-javadoc.noarch 1:0.11a-16.1.al7 base
java_cup-manual.noarch 1:0.11a-16.1.al7 base
javacc.noarch 5.0-10.1.al7 base
javacc-demo.noarch 5.0-10.1.al7 base
javacc-javadoc.noarch 5.0-10.1.al7 base
javacc-manual.noarch 5.0-10.1.al7 base
javacc-maven-plugin.noarch 2.6-17.1.al7 base
javacc-maven-plugin-javadoc.noarch 2.6-17.1.al7 base
javamail.noarch 1.4.6-8.1.al7 base
javamail-javadoc.noarch 1.4.6-8.1.al7 base
javaparser.noarch 1.0.11-3.el7 epel
javaparser-javadoc.noarch 1.0.11-3.el7 epel
javassist.noarch 3.16.1-10.1.al7 base
javassist-javadoc.noarch 3.16.1-10.1.al7 base
javastroke.x86_64 0.5.1-33.el7 epel
javawriter.noarch 2.5.1-4.el7 epel
javawriter-javadoc.noarch 2.5.1-4.el7 epel

3、yum install java-1.7.0-openjdk.x86_64 如卸载使用 yum -y remove java-1.7.0-openjdk*

4、使用

若您安装的是 JRE:

export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))

若您安装的是 JDK:

export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) 
使用JRE

5、将export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))

   export CLASSPATH=.:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar  

    export PATH=$PATH:$JAVA_HOME/bin  

添加到etc/profile最下边,后两句不加可能会有一些问题。

(二)安装tomcat

(1)进入/usr/local/

(2)wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7.0.82/bin/apache-tomcat-7.0.82.tar.gz

(3)tar -zxv -f apache-tomcat-7.0.82.tar.gz

(4)mv apache-tomcat-7.0.82 tomcat

(5)cd /usr/local/tomcat/bin

(6)./startup.sh即可启动,如想开机运行放入启动文件里。