部署Tomcat
//安装jdk环境 [root@hxdserver ~]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel //查看安装的版本 [root@hxdserver ~]# java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)//在官网下载tomcat http://tomcat.apache.org/
[root@hxdserver ~]# cd /usr/src/ [root@hxdserver src]# ls apache-tomcat-9.0.12.tar.gz debug kernels [root@hxdserver src]# tar xf apache-tomcat-9.0.12.tar.gz -C /usr/local/ [root@hxdserver src]# cd /usr/local/ [root@hxdserver local]# ln -s apache-tomcat-9.0.12/ tomcat [root@hxdserver local]# ll 总用量 0 drwxr-xr-x 9 root root 220 10月 29 11:14 apache-tomcat-9.0.12 drwxr-xr-x. 2 root root 6 3月 10 2016 bin drwxr-xr-x. 2 root root 6 3月 10 2016 etc drwxr-xr-x. 2 root root 6 3月 10 2016 games drwxr-xr-x. 2 root root 6 3月 10 2016 include drwxr-xr-x. 2 root root 6 3月 10 2016 lib drwxr-xr-x. 2 root root 6 3月 10 2016 lib64 drwxr-xr-x. 2 root root 6 3月 10 2016 libexec drwxr-xr-x. 2 root root 6 3月 10 2016 sbin drwxr-xr-x. 5 root root 49 9月 8 00:35 share drwxr-xr-x. 2 root root 6 3月 10 2016 src lrwxrwxrwx 1 root root 21 10月 29 11:17 tomcat -> apache-tomcat-9.0.12/ //写一个hello world的java页面 [root@hxdserver ~]# vim index.jsp <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <style type="text/css"> #show{ margin: auto; margin-left: 35%; margin-top: 20%; font-size: 70px; } </style> <script> window.onload=function(){ var story = document.getElementById('word'); var s = document.getElementById('show'); var i = 0; timer=setInterval(function(){ s.innerHTML=story.innerHTML.substring(0,i); i++; if(s.innerHTML==story.innerHTML){ clearInterval(timer); } },200); } </script> </head> <body> <p id="word" style="display:none;">Hello,World</p> <p id="show"></p> </body> </html> [root@hxdserver ~]# mkdir /usr/local/tomcat/webapps/test [root@hxdserver ~]# cp index.jsp /usr/local/tomcat/webapps/test/ [root@hxdserver ~]# ll /usr/local/tomcat/webapps/test/ 总用量 4 -rw-r--r-- 1 root root 808 10月 29 11:23 index.jsp //启动tomcat [root@hxdserver ~]# /usr/local/tomcat/bin/catalina.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. [root@hxdserver ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 100 :::8080 :::* LISTEN 0 128 :::22 :::* LISTEN 0 100 ::1:25 :::* LISTEN 0 1 ::ffff:127.0.0.1:8005 :::* LISTEN 0 100 :::8009 :::*在浏览器上浏览测试页面