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
@H_403_39@<!DOCTYPE html>
@H_502_41@<html lang="en">
    @H_502_41@<head>
        @H_502_41@<Meta charset="UTF-8" />
        @H_502_41@<title>Apache Tomcat/8.0.39@H_502_41@</title>
        @H_502_41@<link href="favicon.ico" rel="icon" type="image/x-icon" />
        @H_502_41@<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
        @H_502_41@<link href="tomcat.css" rel="stylesheet" type="text/css" />
    @H_502_41@</head>

猜你在找的CentOS相关文章