🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
#### 上传Tomcat文件和jdk文件到/opt目录下 下载地址: [Tomcat7下载地址](http://tomcat.apache.org/download-70.cgi "Tomcat7下载地址") [JDK下载地址](http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u80-oth-JPR "jdk下载地址") #### 创建基础目录 ```shell mkdir /app /data ``` #### JDK部署 ```shell cd /opt tar xzf jdk-7u80-linux-x64.gz mv jdk1.7.0_80 /app/ cd /app ln -s jdk1.7.0_80 jdk ``` ##### 上传env_java_tomcat.sh环境变量脚本到/etc/profile.d目录下 文件内容如下: ```shell export JAVA_HOME=/app/jdk export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=$PATH:$JAVA_HOME/bin ``` 加载变量 ```shell source /etc/profile.d/env_java_tomcat.sh ``` ##### 测试jdk java -version ```shell java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode) ``` javac ```shell Usage: javac <options> <source files> where possible options include: -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info ``` #### 部署Tonmcat ```shell cd /opt tar xzf apache-tomcat-7.0.76.tar.gz mv apache-tomcat-7.0.76 /app/ cd /app/ ln -s apache-tomcat-7.0.76 tomcat1 #清除默认项目 rm /app/tomcat1/webapps/* -rf ```