CentOS7安装配置jdk1.8.0_221及apache-tomcat-9.0.24

1.下载安装jdk1.8.0_221

mkdir -p /usr/local/java 

(1)下载jdk-8u221-linux-x64.tar.gz包,并解压到/usr/local/java文件夹下

tar zxvf jdk-8u221-linux-x64.tar.gz -C /usr/local/java/

注:百度网盘分享地址如下:

jdk-8u221-linux-x64.tar.gz

(2)配置环境变量

cd /etc/profile.d
vi java.sh
export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export CLASS_PATH="$JAVA_HOME/lib:$JAVA_HOME/jre/lib"
export PATH=$PATH:$JAVA_HOME/bin 

(3)让配置生效:

source /etc/profile

(4)查看是否安装成功

java -version

2.下载安装apache-tomcat-9.0.24

(1)下载安装包 并解压到相应目录

tar zxvf apache-tomcat-9.0.24.tar.gz -C /usr/local/

(2)配置环境变量

vi /etc/profile.d/tomcat.sh

CATALINA_BASE=/usr/local/apache-tomcat-9.0.24
$PATH=$CATALINA_BASE/bin:$PATH
export PATH CATALINA_BASE

(3) 让配置生效

source /etc/profile.d/tomcat.sh

(4)查看是否安装成功

catalina.sh version

(5)配置防火墙

firewall-cmd --add-port=8080/tcp --permanent 
firewall-cmd --reload

(6)打开tomcat,访问http://localhost:8080是否成功

/usr/local/apache-tomcat-9.0.24/bin/startup.sh
             //开启tomcat
/usr/local/apache-tomcat-9.0.24/bin/shutdown.sh
            //关闭tomcat

发表评论

电子邮件地址不会被公开。 必填项已用*标注