Tomcat介绍、安装jdk、安装tomcat
2018-05-14 本文已影响0人
强出头
Tomcat介绍
安装jdk
安装jdk
[root@iZbp1e0xboek6oow616aoiZ src]# tar zxvf jdk-8u101-linux-x64.tar_a7ab8.gz
root@iZbp1e0xboek6oow616aoiZ src]# mv jdk1.8.0_101/ /usr/local/jdk1.8
[root@izbp1e0xboek6oow616aoiz ~]# vim /etc/profile
#文件最后增加
JAVA_HOME=/usr/local/jdk1.8/
JAVA_BIN=/usr/local/jdk1.8/bin
JRE_HOME=/usr/local/jdk1.8/jre
PATH=$PATH:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/jre/bin
CLASSPATH=/usr/local/jdk1.8/jre/lib:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib/charsets.jar
[root@iZbp1e0xboek6oow616aoiZ src]# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
#如果显示的和安装的版本不一样,尝试搜索卸载
[root@iZbp1e0xboek6oow616aoiZ src]# rpm -qa |grep openjdk
安装Tomcat
[root@iZbp1e0xboek6oow616aoiZ src]# cd /usr/local/src
[root@izbp1e0xboek6oow616aoiz src]# wget http://apache.fayea.com/tomcat/tomcat-9/v9.0.8/bin/apache-tomcat-9.0.8.tar.gz
[root@izbp1e0xboek6oow616aoiz src]# tar -zxvf apache-tomcat-9.0.8.tar.gz
[root@izbp1e0xboek6oow616aoiz src]# mv apache-tomcat-9.0.8 /usr/local/tomcat
[root@izbp1e0xboek6oow616aoiz bin]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@izbp1e0xboek6oow616aoiz bin]# source /etc/profile
[root@izbp1e0xboek6oow616aoiz bin]# ps aux |grep tomcat
root 12751 0.0 0.0 127584 1168 pts/0 S+ 12:27 0:00 screen -S tomcat
root 12752 0.0 0.0 127848 1504 ? Ss 12:27 0:00 SCREEN -S tomcat
root 12947 28.0 4.5 2515940 85296 pts/2 Sl 12:45 0:03 /usr/local/jdk1.8/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 12990 0.0 0.0 112676 984 pts/2 S+ 12:46 0:00 grep --color=auto tomcat
[root@izbp1e0xboek6oow616aoiz ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 12947/java
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 12947/java
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2668/sshd
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 12947/java
tcp6 0 0 :::3306 :::* LISTEN 1408/mysqld
配置Tomcat监听80端口
配置Tomcat监听80端口
[root@izbp1e0xboek6oow616aoiz ~]# vim /usr/local/tomcat/conf/server.xml
Connector port="8080" protocol="HTTP/1.1"修改为Connector port="80" protocol="HTTP/1.1"
[root@izbp1e0xboek6oow616aoiz ~]# /usr/local/tomcat/bin/shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@izbp1e0xboek6oow616aoiz ~]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.8/jre
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@izbp1e0xboek6oow616aoiz ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 13400/java
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13400/java
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2668/sshd
tcp6 0 0 :::3306 :::*
扩展
java容器比较 http://my.oschina.net/diedai/blog/271367
http://www.360doc.com/content/11/0618/21/16915_127901371.shtml
j2ee、j2se、ejb、javabean、serverlet、jsp之间关系 http://bbs.csdn.net/topics/50015576
tomcat server.xml配置详解 http://blog.csdn.net/yuanxuegui2008/article/details/6056754
tomcat常用数据库连接的方法 http://wjw7702.blog.51cto.com/5210820/1109263