1、服务器需要安装对应开发版本的jdk
在官网下载jdk对应的jdk版本,解压到某个目录下如:
[email protected]:/home/guchen/usr/java# ls jdk1.8.0_111 jdk-8u111-linux-x64.tar.gz
解压命令 tar -xzvf jdk-8u111-linux-x64.tar.gz
2.进入 vi /etc/profile 中添加环境变量如下:
1 #jdk1.8.0._111 2 JAVA_HOME=/home/guchen/usr/java/jdk1.8.0_111 3 JRE_HOME=/home/guchen/usr/java/jdk1.8.0_111/jre 4 MAVEN_HOME=/home/guchen/usr/local/apache-maven-3.3.9 5 PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$MAVEN_HOME/bin 6 CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib 7 export JAVA_HOME JRE_HOME MAVEN_HOME PATH CLASSPATH
保存退出后使环境变量生效,执行:source /etc/profile
3、安装tomcat
下载tomcat,并解压到某个目录下如:
[email protected]:/home/guchen/usr/local# ls apache-maven-3.3.9 apache-maven-3.3.9-bin.tar.gz apache-tomcat-7.0.72 apache-tomcat-7.0.72.tar.gz
4、把war包放进webapps下面重启tomcat就ok啦
[email protected]:/home/guchen/usr/local/apache-tomcat-7.0.72/webapps# ls docs examples host-manager jenkins jenkins.war manager operation-centre operation-centre.war ROOT
进入到bin目录下重启tomcat,执行命令 ./startup.sh
[email protected]:/home/guchen/usr/local/apache-tomcat-7.0.72/bin# ./startup.sh Using CATALINA_BASE: /home/guchen/usr/local/apache-tomcat-7.0.72 Using CATALINA_HOME: /home/guchen/usr/local/apache-tomcat-7.0.72 Using CATALINA_TMPDIR: /home/guchen/usr/local/apache-tomcat-7.0.72/temp Using JRE_HOME: /home/guchen/usr/java/jdk1.8.0_111/jre Using CLASSPATH: /home/guchen/usr/local/apache-tomcat-7.0.72/bin/bootstrap.jar:/home/guchen/usr/local/apache-tomcat-7.0.72/bin/tomcat-juli.jar Tomcat started. [email protected]-ubuntu16-04lts:/home/guchen/usr/local/apache-tomcat-7.0.72/bin#
网址输入IP:8080
如果出现tomcat首页则说明安装ok
时间: 2024-10-11 22:46:50