1、Tomcat介绍
2、安装jdk
下载:wget -c http://download.oracle.com/otn-pub/java/jdk/10.0.1+10/fb4372174a714e6b8c52526dc134031e/jdk-10.0.1_linux-x64_bin.tar.gz?AuthParam=1529977312_d287a2fceaf1a063b3daf34e3d999714
改名:mv jdk-10.0.1_linux-x64_bin.tar.gz\?AuthParam\=1529977312_d287a2fceaf1a063b3daf34e3d999714 jdk-10.0.1_linux-x64_bin.tar.gz
解压:tar -xvf jdk-10.0.1_linux-x64_bin.tar.gz
移动到:mv jdk-10.0.1 /usr/local/jdk10
修改/etc/profile文件:
加入:
JAVA_HOME=/usr/local/jdk10/
JAVA_BIN=/usr/local/jdk10/bin
JRE_HOME=/usr/local/jdk10/jre
PATH=$PATH:/usr/local/jdk10/bin:/usr/local/jdk10/jre/bin
CLASSPATH=/usr/local/jdk10/jre/lib:/usr/local/jdk10/lib:/usr/local/jdk10/jre/lib
然后再读取配制文件:source /etc/profile
查看是否安装成功没:java -version (若能正常看到相应的版本,就没有问题)
3、安装Tomcat
下载:wget -c http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.8/bin/apache-tomcat-9.0.8.tar.gz
解压:tar -xvf apache-tomcat-9.0.8.tar.gz
移动:mv apache-tomcat-9.0.8 /usr/local/tomcat9
启动:/usr/local/tomcat9/bin/startup.sh
关闭:/usr/local/tomcat9/bin/shutdown.sh
查看:netstat -tulnp |grep java
访问测试:
相关端口:
4、配置Tomcat监听80端口
修改:vim /usr/local/tomcat9/conf/server.xml
sed -i 's/Connector port="8080"/Connector port="80"/' /usr/local/tomcat9/conf/server.xml
把8080端口改为80端口
关闭tomcat 然后再重启
查看访问(需要等待8005端口启动后,访问速度才会快起来):