centos安装及设置 jdk/tomcat

时间:2021-01-15 16:36:56

首先现在jdk和tomcat:

[root@yrok ~]# wget http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-x64.rpm

[root@yrok ~]# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz
[root@yrok ~]# ls
apache-tomcat-8.0.36.tar.gz  jdk-8u73-linux-x64.rpm

 安装jdk:

[root@yrok ~]# yum install jdk-8u73-linux-x64.rpm

设置jdk环境变量:

[root@yrok ~]# vim /etc/profile.d/java.sh
export JAVA_HOME=/usr/java/latest
export PATH=$JAVA_HOME/bin:$PATH

[root@yrok ~]# . /etc/profile.d/java.sh

查看jdk版本:

[root@yrok ~]# java -version
java version "1.8.0_73"

解压安装tomcat:

[root@yrok ~]# tar xf apache-tomcat-8.0.36.tar.gz -C /usr/local
[root@yrok ~]# cd /usr/local/

[root@yrok local]# ln -sv apache-tomcat-8.0.36 tomcat

设置链接:

"tomcat" -> "apache-tomcat-8.0.36"

 设置tomcat环境变量:

[root@yrok tomcat]# vim /etc/profile.d/tomcat.sh
export CATALINA_HOME=/usr/local/tomcat
export PATH=$CATALINA_HOME/bin:$PATH

[root@yrok tomcat]# . /etc/profile.d/tomcat.sh

以上就完成了jdk和tomcat的设置。