centos8下jdk13和tomcat9的安装
首先下载JDK13和tomcat9在对应的官网上;
通过xftp传到linux服务器上的对应的目录,如/usr/local apache-tomcat-9.0.27.tar.gz ,jdk-13.0.1_linux-x64_bin.tar.gz
通过 tar命令解压如下:
tar -xzvf jdk-13.0.1_linux-x64_bin.tar.gz
tar -xzvf apache-tomcat-9.0.27.tar.gz
解压后生成的文件为:
jdk-13.0.1
apache-tomcat-9.0.27
通过
mv /usr/local/apache-tomcat-9.0.27/ /usr/local/tomcat9
mv /usr/local/jdk-13.0.1/ /usr/local/java
设置环境变量
vim /etc/profile
#set java environment
export JAVA_HOME=/usr/local/java
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/tool.jar
export PATH=$PATH:/usr/local/java/bin
vim /usr/local/tomcat9/bin/startup.sh
vim /usr/local/tomcat9/bin/shutdown.sh
添加如下信息:
export JAVA_HOME=/usr/local/java
export TOMCAT_HOME=/usr/local/tomcat9
export CATALINA_HOME=/usr/local/tomcat9
export CLASS_PATH=$JAVA_HOME/bin/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tool.jar
export PATH=$PATH:/usr/local/java/bin:/usr/local/tomcat9/bin
配置好后,启动tomcat
在浏览器访问
开机自启动Tomcat:
1.修改脚本文件vi /etc/rc.d/rc.local
2.添加如下内容:
export JAVA_HOME=/usr/local/java/jdk1.8.0_171
/usr/local/apache-tomcat-8.5.32/bin/startup.sh start
3.esc 退出编辑,:wq 保存修改
4.将rc.local修改为可执行
chmod -R 777 /etc/rc.d/rc.local