一、安装jdk
[[email protected] ~]# yum -y list java* Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirror.bit.edu.cn * updates: mirrors.aliyun.com Available Packages java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.161-2.6.12.0.el6_9 updates java-1.7.0-openjdk-src.x86_64 1:1.7.0.161-2.6.12.0.el6_9 updates java-1.8.0-openjdk.x86_64 1:1.8.0.161-3.b14.el6_9 updates java-1.8.0-openjdk-debug.x86_64 1:1.8.0.161-3.b14.el6_9 updates [[email protected] ~]# yum install java-1.8.0-openjdk.x86_64 -y [[email protected] ~]# java -version openjdk version "1.8.0_161" OpenJDK Runtime Environment (build 1.8.0_161-b14) OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
二、安装Tomcat
[[email protected] ~]# mkdir -p tools [[email protected] ~]# cd tools/ [[email protected] tools]# ll total 8780 -rw-r--r-- 1 root root 8989099 Feb 28 00:31 apache-tomcat-7.0.81.tar.gz [[email protected] tools]# tar xf apache-tomcat-7.0.81.tar.gz -C /usr/local/ [[email protected] ~]# cd /usr/local/ [[email protected] local]# mv apache-tomcat-7.0.81 tomcat
三、启动Tomcat
[[email protected] local]# /usr/local/tomcat/bin/startup.sh configtest # 检查配置文件是否正确 Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. [[email protected] local]# /usr/local/tomcat/bin/startup.sh start # 启动 Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. [[email protected] ~]# netstat -lntup|grep java tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 1612/java tcp 0 0 :::8009 :::* LISTEN 1612/java tcp 0 0 :::8080 :::* LISTEN 1612/java
四、网页访问
[[email protected] ~]# vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT [[email protected] ~]# /etc/init.d/iptables restart
原文地址:https://www.cnblogs.com/linu/p/8481674.html
时间: 2024-11-08 19:59:28