(一)安裝JAVA
一、檢查java環境 java -version,不存在安裝。
二、yum -y list java*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 apache
三、yum install java-1.7.0-openjdk.x86_64 如卸載使用 yum -y remove java-1.7.0-openjdk*tomcat
四、使用app
若您安裝的是 JRE:less
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) maven
若您安裝的是 JDK:debug
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
使用JREip
五、將export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
rem
export CLASSPATH=.:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar get
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便可啓動,如想開機運行放入啓動文件裏。