Centos 安装java与tomcat

前端之家收集整理的这篇文章主要介绍了Centos 安装java与tomcat前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Centos 安装java与tomcat

安装java

yum install java

#查看java版本
[root@eae118554e31 bin]# java -version
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15,mixed mode)

安装tomcat

yum install lrzsz
mkdir /gdtel
#上传apache-tomcat-8.0.39.tar.gz到/getel
cd /gdtel
tar -zxv -f apache-tomcat-8.0.39.tar.gz

#启动
sh /gdtel/apache-tomcat-8.0.39/bin/startup.sh

#启动成功如下
[root@eae118554e31 bin]# sh startup.sh
Using CATALINA_BASE:   /gdtel/apache-tomcat-8.0.39
Using CATALINA_HOME:   /gdtel/apache-tomcat-8.0.39
Using CATALINA_TMPDIR: /gdtel/apache-tomcat-8.0.39/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /gdtel/apache-tomcat-8.0.39/bin/bootstrap.jar:/gdtel/apache-tomcat-8.0.39/bin/tomcat-juli.jar
Tomcat started.

#增加防火墙
iptables -A INPUT -s 132.97.0.0/16 -p tcp -m tcp --dport 8080 -j ACCEPT
#保存防火墙
service iptables save

#查看网站是否正常
[root@eae118554e31 bin]# curl http://127.0.0.1:8080
<!DOCTYPE html>
<html lang="en">
    <head>
        <Meta charset="UTF-8" />
        <title>Apache Tomcat/8.0.39</title>
        <link href="favicon.ico" rel="icon" type="image/x-icon" />
        <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <link href="tomcat.css" rel="stylesheet" type="text/css" />
    </head>
原文链接:https://www.f2er.com/centos/378986.html

猜你在找的CentOS相关文章