jdk下載
http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
tomcat下載
http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.73/bin/apache-tomcat-7.0.73.tar.gzjava
分別解壓至各自文件夾 tar -zxvf xx.tar.gzlinux
$ sudo vim /etc/profileapache
#java環境變量設置
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_121 選擇本身下載的jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATHvim
#tomcat環境設置
CATALINA_HOME=/usr/local/tomcat7
export CATALINA_HOMEtomcat
$source /etc/profile 生效oracle
#編輯tomcat設置jvm
$sudo vim bin/catalina.sh
#在文本開頭添加
CATALINA_HOME=/usr/local/tomcat7
JAVA_HOME=/usr/local/java/jdk1.8.0_121
JRE_HOME=${JAVA_HOME}/jre 變量
#啓動tomcat
$sudo ./bin/startup.shjdk
輸入localhost:8080查看file