linux-jdk安装,tomcat安装

一、下载jdk

官方下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html

二、linux安装jdk

[[email protected] ~]# ls
anaconda-ks.cfg              Desktop    icbc_auto_platform  jdk-8u131-linux-x64.rpm  mysql-5.6.13-linux-glibc2.5-x86_64         Public     tornado-3.1.0
apache-tomcat-6.0.53.tar.gz  Documents  install.log         main                     mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz  static     v3.1.0.tar.gz
demo                         Downloads  install.log.syslog  Music                    Pictures                                   Templates  Videos
[[email protected] ~]#rpm -ivh jdk-8u131-linux-x64.rpm

[[email protected] ~]# rpm -qa | grep jdk
jdk1.8.0_131-1.8.0_131-fcs.x86_64
[[email protected] ~]# rpm -ql jdk1.8.0_131-1.8.0_131-fcs.x86_64  ---- 查看jdk安装路径

/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/console_view.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/date-span-16.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/day-of-week-16.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/diagnostic-command-16.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/hprof-16.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/send-email-16.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/icons/time-span-16.png
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/lib
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/lib/dsn.jar
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/lib/gimap.jar
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/lib/imap.jar
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/lib/mailapi.jar
/usr/java/jdk1.8.0_131/lib/missioncontrol/plugins/com.jrockit.mc.rjmx_5.5.1.172852/lib/pop3.jar

[[email protected] ~]# cd /usr/java/    ---- jdk独特的安装路径/usr/java

[[email protected] java]# ls
default  jdk1.8.0_131  latest
[[email protected] java]# ll
total 4
lrwxrwxrwx. 1 root root   16 May 29 04:53 default -> /usr/java/latest
drwxr-xr-x. 9 root root 4096 May 29 04:53 jdk1.8.0_131
lrwxrwxrwx. 1 root root   22 May 29 04:53 latest -> /usr/java/jdk1.8.0_131
[[email protected] java]# cd /usr/java/jdk1.8.0_131/
[[email protected] jdk1.8.0_131]# ll
total 25884
drwxr-xr-x. 2 root root     4096 May 29 04:53 bin
-rw-r--r--. 1 root root     3244 Mar 15 01:32 COPYRIGHT
drwxr-xr-x. 4 root root     4096 May 29 04:53 db
drwxr-xr-x. 3 root root     4096 May 29 04:53 include
-rwxr-xr-x. 1 root root  5097105 Mar 14 21:39 javafx-src.zip
drwxr-xr-x. 5 root root     4096 May 29 04:53 jre
drwxr-xr-x. 5 root root     4096 May 29 04:53 lib
-rw-r--r--. 1 root root       40 Mar 15 01:32 LICENSE
drwxr-xr-x. 4 root root     4096 May 29 04:53 man
-rw-r--r--. 1 root root      159 Mar 15 01:32 README.html
-rw-r--r--. 1 root root      526 Mar 15 01:32 release
-rw-r--r--. 1 root root 21115141 Mar 15 01:32 src.zip
-rwxr-xr-x. 1 root root    63933 Mar 14 21:39 THIRDPARTYLICENSEREADME-JAVAFX.txt
-rw-r--r--. 1 root root   177094 Mar 15 01:32 THIRDPARTYLICENSEREADME.txt
[[email protected] jdk1.8.0_131]#

三、配置java环境变量

[[email protected] bin]# vi /etc/profile.d/java.sh  
[[email protected] bin]# cat /etc/profile.d/java.sh   --- jdk环境变量配置文件
export JAVA_HOME=/usr/java/latest
export PATH=$JAVA_HOME/bin:$PATH
[[email protected] bin]# . /etc/profile.d/java.sh    --- 重读配置文件

[[email protected] bin]# java -version   --- 验证环境变量配置成功

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
[[email protected] bin]#



一、下载tomcat

官方下载地址:http://tomcat.apache.org

二、linux解压tomcat源码

[[email protected] ~]# ls
anaconda-ks.cfg              Desktop    icbc_auto_platform  jdk-8u131-linux-x64.rpm  mysql-5.6.13-linux-glibc2.5-x86_64         Public     tornado-3.1.0
apache-tomcat-6.0.53.tar.gz  Documents  install.log         main                     mysql-5.6.13-linux-glibc2.5-x86_64.tar.gz  static     v3.1.0.tar.gz
demo                         Downloads  install.log.syslog  Music                    Pictures                                   Templates  Videos

[[email protected] ~]# tar xf apache-tomcat-6.0.53.tar.gz -C /usr/local/   --- 将源码解压到/usr/local路径
[[email protected] ~]# cd /usr/local/
[[email protected] local]# ls
apache-tomcat-6.0.53  bin  etc  games  gcc  include  info  lib  lib64  libexec  man  mysql  python27  sbin  share  src
[[email protected] local]# ln -sv apache-tomcat-6.0.53 tomcat   --- 创建链接tomcat
`tomcat‘ -> `apache-tomcat-6.0.53‘
[[email protected] local]# ll
total 64
drwxr-xr-x.  9 root root 4096 May 29 05:11 apache-tomcat-6.0.53
drwxr-xr-x.  2 root root 4096 May  9 07:55 bin  
drwxr-xr-x.  2 root root 4096 Mar 26 16:01 etc
drwxr-xr-x.  2 root root 4096 Jun 28  2011 games
drwxr-xr-x.  2 root root 4096 Mar 26 12:14 gcc
drwxr-xr-x.  3 root root 4096 Mar 26 10:34 include
drwxr-xr-x.  2 root root 4096 Mar 26 10:34 info
drwxr-xr-x.  2 root root 4096 Mar 26 16:01 lib 
drwxr-xr-x.  2 root root 4096 Jun 28  2011 lib64
drwxr-xr-x.  2 root root 4096 Jun 28  2011 libexec
drwxr-xr-x.  3 root root 4096 Mar 26 10:34 man
drwxr-xr-x. 13 root root 4096 May  9 07:35 mysql
drwxr-xr-x.  6 root root 4096 Mar 26 17:52 python27
drwxr-xr-x.  2 root root 4096 Jun 28  2011 sbin
drwxr-xr-x.  7 root root 4096 Mar 26 16:01 share
drwxr-xr-x.  2 root root 4096 Jun 28  2011 src
lrwxrwxrwx.  1 root root   20 May 29 05:12 tomcat -> apache-tomcat-6.0.53
[[email protected] local]# cd tomcat/
[[email protected] tomcat]# ll
total 116
drwxr-xr-x. 2 root root  4096 May 29 05:11 bin   --- 脚本及启动相关类
drwxr-xr-x. 3 root root  4096 May 29 05:32 conf  --- 配置文件
drwxr-xr-x. 2 root root  4096 May 29 05:11 lib   --- 类库

-rw-r--r--. 1 root root 56685 Apr  2 00:29 LICENSE
drwxr-xr-x. 2 root root  4096 May 29 05:32 logs   --- 日志文件
-rw-r--r--. 1 root root   807 Apr  2 00:29 NOTICE
-rw-r--r--. 1 root root  9124 Apr  2 00:29 RELEASE-NOTES
-rw-r--r--. 1 root root 16220 Apr  2 00:29 RUNNING.txt
drwxr-xr-x. 2 root root  4096 May 29 05:11 temp   --- 临时目录
drwxr-xr-x. 7 root root  4096 Apr  2 00:29 webapps   --- 应用程序默认部署目录
drwxr-xr-x. 3 root root  4096 May 29 05:32 work   --- 工作目录
You have new mail in /var/spool/mail/root
[[email protected] tomcat]#

三、tomcat配置文件

[[email protected] tomcat]# vim /etc/profile.d/tomcat.sh

[[email protected] tomcat]# cat /etc/profile.d/tomcat.sh  ---配置tomcat环境变量
export CATALINA_HOME=/usr/local/tomcat
export PATH=$CATALINA_HOME/bin:$PATH
[[email protected] tomcat]# . /etc/profile.d/tomcat.sh   --- 重读tomcat配置文件

[[email protected] tomcat]# version.sh   --- 验证tomcat环境变量配置成功
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/latest
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.53
Server built:   Apr 2 2017 07:25:00 UTC
Server number:  6.0.53.0
OS Name:        Linux
OS Version:     2.6.32-504.el6.x86_64
Architecture:   amd64
JVM Version:    1.8.0_131-b11    --- jvm版本
JVM Vendor:     Oracle Corporation
[[email protected] tomcat]# ls bin/   ---  .sh脚本可以直接运行 或 catalina.sh + 命令 使用
bootstrap.jar  catalina-tasks.xml            cpappend.bat  digest.sh         shutdown.bat  startup.sh            tool-wrapper.bat  version.sh
catalina.bat   commons-daemon.jar            daemon.sh     setclasspath.bat  shutdown.sh   tomcat-juli.jar       tool-wrapper.sh
catalina.sh    commons-daemon-native.tar.gz  digest.bat    setclasspath.sh   startup.bat   tomcat-native.tar.gz  version.bat
[[email protected] tomcat]# catalina.sh version
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/latest
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar
Server version: Apache Tomcat/6.0.53
Server built:   Apr 2 2017 07:25:00 UTC
Server number:  6.0.53.0
OS Name:        Linux
OS Version:     2.6.32-504.el6.x86_64
Architecture:   amd64
JVM Version:    1.8.0_131-b11
JVM Vendor:     Oracle Corporation
[[email protected] tomcat]#

四、启动tomcat

[[email protected] tomcat]# catalina.sh --help
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/latest
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar
Usage: catalina.sh ( commands ... )
commands:
  debug             Start Catalina in a debugger
  debug -security   Debug Catalina with a security manager
  jpda start        Start Catalina under JPDA debugger
  run               Start Catalina in the current window
  run -security     Start in the current window with security manager
  start             Start Catalina in a separate window
  start -security   Start in a separate window with security manager
  stop              Stop Catalina, waiting up to 5 seconds for the process to end
  stop n            Stop Catalina, waiting up to n seconds for the process to end
  stop -force       Stop Catalina, wait up to 5 seconds and then use kill -KILL if still running
  stop n -force     Stop Catalina, wait up to n seconds and then use kill -KILL if still running
  version           What version of tomcat are you running?
Note: Waiting for the process to end and use of the -force option require that $CATALINA_PID is defined
[[email protected] tomcat]#


注意:tomcat默认开启在8080端口

[[email protected] tomcat]# ss -tnl
State       Recv-Q Send-Q                                             Local Address:Port                                               Peer Address:Port
LISTEN      0      128                                                           :::22                                                           :::*    
LISTEN      0      128                                                            *:22                                                            *:*    
LISTEN      0      128                                                    127.0.0.1:631                                                           *:*    
LISTEN      0      128                                                          ::1:631                                                          :::*    
LISTEN      0      100                                                          ::1:25                                                           :::*    
LISTEN      0      100                                                    127.0.0.1:25                                                            *:*    
LISTEN      0      80                                                            :::3306                                                         :::*    
[[email protected] tomcat]#

[[email protected] tomcat]# catalina.sh start   --- 运行tomcat
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/java/latest
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar
[[email protected] tomcat]# ss -tnl 
State       Recv-Q Send-Q                                             Local Address:Port                                               Peer Address:Port
LISTEN      0      128                                                           :::22                                                           :::*    
LISTEN      0      128                                                            *:22                                                            *:*    
LISTEN      0      128                                                    127.0.0.1:631                                                           *:*    
LISTEN      0      128                                                          ::1:631                                                          :::*    
LISTEN      0      100                                                          ::1:25                                                           :::*    
LISTEN      0      100                                                    127.0.0.1:25                                                            *:*    
LISTEN      0      1                                               ::ffff:127.0.0.1:8005                                                         :::*    
LISTEN      0      50                                                            :::8009                                                         :::*    
LISTEN      0      80                                                            :::3306                                                         :::*    
LISTEN      0      100                                                           :::8080                                                         :::*    
[[email protected] tomcat]# ss -tnlp
State       Recv-Q Send-Q                                             Local Address:Port                                               Peer Address:Port
LISTEN      0      128                                                           :::22                                                           :::*      users:(("sshd",1972,4))
LISTEN      0      128                                                            *:22                                                            *:*      users:(("sshd",1972,3))
LISTEN      0      128                                                    127.0.0.1:631                                                           *:*      users:(("cupsd",1857,7))
LISTEN      0      128                                                          ::1:631                                                          :::*      users:(("cupsd",1857,6))
LISTEN      0      100                                                          ::1:25                                                           :::*      users:(("master",2131,13))
LISTEN      0      100                                                    127.0.0.1:25                                                            *:*      users:(("master",2131,12))
LISTEN      0      1                                               ::ffff:127.0.0.1:8005                                                         :::*      users:(("java",13729,48))
LISTEN      0      50                                                            :::8009                                                         :::*      users:(("java",13729,46))
LISTEN      0      80                                                            :::3306                                                         :::*      users:(("mysqld",11923,10))
LISTEN      0      100                                                           :::8080                                                         :::*      users:(("java",13729,41))   --- java程序监听,而不是tomcat监听
[[email protected] tomcat]# ps -aux
Warning: bad syntax, perhaps a bogus ‘-‘? See /usr/share/doc/procps-3.2.8/FAQ
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.1  19364   528 ?        Ss   May27   0:01 /sbin/init
root          2  0.0  0.0      0     0 ?        S    May27   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        S    May27   0:00 [migration/0]
root          4  0.0  0.0      0     0 ?        S    May27   0:00 [ksoftirqd/0]
root          5  0.0  0.0      0     0 ?        S    May27   0:00 [stopper/0]
root          6  0.0  0.0      0     0 ?        S    May27   0:00 [watchdog/0]
root          7  0.0  0.0      0     0 ?        S    May27   0:39 [events/0]
root          8  0.0  0.0      0     0 ?        S    May27   0:00 [cgroup]
root          9  0.0  0.0      0     0 ?        S    May27   0:00 [khelper]
root         10  0.0  0.0      0     0 ?        S    May27   0:00 [netns]
root         11  0.0  0.0      0     0 ?        S    May27   0:00 [async/mgr]
root         12  0.0  0.0      0     0 ?        S    May27   0:00 [pm]
root         13  0.0  0.0      0     0 ?        S    May27   0:00 [sync_supers]
root         14  0.0  0.0      0     0 ?        S    May27   0:00 [bdi-default]
root         15  0.0  0.0      0     0 ?        S    May27   0:00 [kintegrityd/0]
root         16  0.0  0.0      0     0 ?        S    May27   0:05 [kblockd/0]
root         17  0.0  0.0      0     0 ?        S    May27   0:00 [kacpid]
root         18  0.0  0.0      0     0 ?        S    May27   0:00 [kacpi_notify]
root         19  0.0  0.0      0     0 ?        S    May27   0:00 [kacpi_hotplug]
root         20  0.0  0.0      0     0 ?        S    May27   0:00 [ata_aux]
root         21  0.0  0.0      0     0 ?        S    May27   0:00 [ata_sff/0]
root         22  0.0  0.0      0     0 ?        S    May27   0:00 [ksuspend_usbd]
root         23  0.0  0.0      0     0 ?        S    May27   0:00 [khubd]
root         24  0.0  0.0      0     0 ?        S    May27   0:00 [kseriod]
root         25  0.0  0.0      0     0 ?        S    May27   0:00 [md/0]
root         26  0.0  0.0      0     0 ?        S    May27   0:00 [md_misc/0]
root         27  0.0  0.0      0     0 ?        S    May27   0:00 [linkwatch]
root         29  0.0  0.0      0     0 ?        S    May27   0:00 [khungtaskd]
root         30  0.0  0.0      0     0 ?        S    May27   0:01 [kswapd0]
root         31  0.0  0.0      0     0 ?        SN   May27   0:00 [ksmd]
root         32  0.0  0.0      0     0 ?        S    May27   0:00 [aio/0]
root         33  0.0  0.0      0     0 ?        S    May27   0:00 [crypto/0]
root         41  0.0  0.0      0     0 ?        S    May27   0:00 [kthrotld/0]
root         42  0.0  0.0      0     0 ?        S    May27   0:00 [pciehpd]
root         44  0.0  0.0      0     0 ?        S    May27   0:00 [kpsmoused]
root         45  0.0  0.0      0     0 ?        S    May27   0:00 [usbhid_resumer]
root         46  0.0  0.0      0     0 ?        S    May27   0:00 [deferwq]
root         77  0.0  0.0      0     0 ?        S    May27   0:00 [kdmremove]
root         78  0.0  0.0      0     0 ?        S    May27   0:00 [kstriped]
root        151  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_0]
root        152  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_1]
root        158  0.0  0.0      0     0 ?        S    May27   0:01 [mpt_poll_0]
root        159  0.0  0.0      0     0 ?        S    May27   0:00 [mpt/0]
root        160  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_2]
root        255  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_3]
root        256  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_4]
root        257  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_5]
root        258  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_6]
root        259  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_7]
root        260  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_8]
root        261  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_9]
root        262  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_10]
root        263  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_11]
root        264  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_12]
root        265  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_13]
root        266  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_14]
root        267  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_15]
root        268  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_16]
root        269  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_17]
root        270  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_18]
root        271  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_19]
root        272  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_20]
root        273  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_21]
root        274  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_22]
root        275  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_23]
root        276  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_24]
root        277  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_25]
root        278  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_26]
root        279  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_27]
root        280  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_28]
root        281  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_29]
root        282  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_30]
root        283  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_31]
root        284  0.0  0.0      0     0 ?        S    May27   0:00 [scsi_eh_32]
root        337  0.0  0.0      0     0 ?        S    May27   0:01 [jbd2/sda2-8]
root        338  0.0  0.0      0     0 ?        S    May27   0:00 [ext4-dio-unwrit]
root        429  0.0  0.0  11268   392 ?        S<s  May27   0:00 /sbin/udevd -d
root        520  0.0  0.0      0     0 ?        S    May27   0:03 [flush-8:0]
root        773  0.0  0.0      0     0 ?        S    May27   0:01 [vmmemctl]
root        950  0.0  0.0      0     0 ?        S    May27   0:00 [jbd2/sda1-8]
root        951  0.0  0.0      0     0 ?        S    May27   0:00 [ext4-dio-unwrit]
root       1038  0.0  0.0      0     0 ?        S    May27   0:00 [kauditd]
root       1343  0.0  0.0 111576    36 ?        Ssl  May27   0:00 /usr/sbin/vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /
root       1364  0.0  0.3 177092  1908 ?        Sl   May27   1:07 /usr/sbin/vmtoolsd
root       1389  0.0  0.0  51004    40 ?        S    May27   0:00 /usr/lib/vmware-vgauth/VGAuthService -s
root       1455  0.0  0.1 203880   740 ?        Sl   May27   0:22 /usr/lib/vmware-caf/pme/bin/ManagementAgentHost
root       1715  0.0  0.0  27596   336 ?        S<sl May27   0:00 auditd
root       1745  0.0  0.1 251200   692 ?        Sl   May27   0:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
dbus       1817  0.0  0.1  32108   816 ?        Ssl  May27   0:00 dbus-daemon --system
root       1829  0.0  0.3 173084  1660 ?        Ssl  May27   0:00 NetworkManager --pid-file=/var/run/NetworkManager/NetworkManager.pid
root       1835  0.0  0.1  58136   616 ?        S    May27   0:00 /usr/sbin/modem-manager
root       1855  0.0  0.0  44988    36 ?        Ss   May27   0:00 /usr/sbin/wpa_supplicant -c /etc/wpa_supplicant/wpa_supplicant.conf -B -u -f /var/log/wpa
root       1857  0.0  0.0 189408    40 ?        Ss   May27   0:00 cupsd -C /etc/cups/cupsd.conf
root       1886  0.0  0.0   4080    36 ?        Ss   May27   0:00 /usr/sbin/acpid
68         1896  0.0  0.2  39348  1272 ?        Ssl  May27   0:00 hald
root       1897  0.0  0.0  20400    40 ?        S    May27   0:00 hald-runner
root       1941  0.0  0.0  22520    36 ?        S    May27   0:00 hald-addon-input: Listening on /dev/input/event2 /dev/input/event0
68         1945  0.0  0.0  18008    40 ?        S    May27   0:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
root       1972  0.0  0.0  66688   212 ?        Ss   May27   0:00 /usr/sbin/sshd
root       2131  0.0  0.0  81328   260 ?        Ss   May27   0:00 /usr/libexec/postfix/master
postfix    2151  0.0  0.0  81592   424 ?        S    May27   0:00 qmgr -l -t fifo -u
root       2159  0.0  0.0 114644    40 ?        Ss   May27   0:00 /usr/sbin/abrtd
root       2170  0.0  0.0 117332   356 ?        Ss   May27   0:01 crond
root       2184  0.0  0.0  21576    64 ?        Ss   May27   0:00 /usr/sbin/atd
root       2198  0.0  0.0 108340   312 ?        Ss   May27   0:00 /usr/bin/rhsmcertd
root       2213  0.0  0.1 134008   652 ?        Ssl  May27   0:00 /usr/sbin/gdm-binary -nodaemon
root       2218  0.0  0.0   4064    32 tty2     Ss+  May27   0:00 /sbin/mingetty /dev/tty2
root       2220  0.0  0.0   4064    32 tty3     Ss+  May27   0:00 /sbin/mingetty /dev/tty3
root       2222  0.0  0.0   4064    32 tty4     Ss+  May27   0:00 /sbin/mingetty /dev/tty4
root       2225  0.0  0.1  12584   536 ?        S<   May27   0:00 /sbin/udevd -d
root       2226  0.0  0.1  12584   536 ?        S<   May27   0:00 /sbin/udevd -d
root       2228  0.0  0.0   4064    32 tty5     Ss+  May27   0:00 /sbin/mingetty /dev/tty5
root       2230  0.0  0.0   4064    32 tty6     Ss+  May27   0:00 /sbin/mingetty /dev/tty6
root       2241  0.0  0.0 164632    40 ?        Sl   May27   0:00 /usr/libexec/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root       2244  0.0  2.4 144072 11956 tty1     Ss+  May27   0:02 /usr/bin/Xorg :0 -br -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-lFW12R/database -n
root       2261  0.0  0.1 577708   920 ?        Sl   May27   0:00 /usr/sbin/console-kit-daemon --no-daemon
gdm        2331  0.0  0.0  20040    36 ?        S    May27   0:00 /usr/bin/dbus-launch --exit-with-session
gdm        2332  0.0  0.0  31808   336 ?        Ssl  May27   0:00 /bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session
gdm        2334  0.0  0.2 269628   992 ?        Ssl  May27   0:00 /usr/bin/gnome-session --autostart=/usr/share/gdm/autostart/LoginWindow/
root       2337  0.0  0.1  49988   696 ?        S    May27   0:00 /usr/libexec/devkit-power-daemon
gdm        2341  0.0  0.1 133264   596 ?        S    May27   0:00 /usr/libexec/gconfd-2
gdm        2359  0.0  0.1 120712   836 ?        S    May27   0:00 /usr/libexec/at-spi-registryd
gdm        2361  0.0  3.6 365664 17548 ?        Ssl  May27   0:52 /usr/libexec/gnome-settings-daemon --gconf-prefix=/apps/gdm/simple-greeter/settings-manag
gdm        2363  0.0  0.0 358452    40 ?        Ssl  May27   0:00 /usr/libexec/bonobo-activation-server --ac-activate --ior-output-fd=12
gdm        2371  0.0  0.0 135284    40 ?        S    May27   0:00 /usr/libexec/gvfsd
gdm        2372  0.0  0.1 288028   916 ?        S    May27   0:00 metacity
gdm        2375  0.0  0.1 274168   928 ?        S    May27   0:00 gnome-power-manager
gdm        2376  0.0  0.0 284160    40 ?        S    May27   0:00 plymouth-log-viewer --icon
gdm        2377  0.0  0.9 383540  4620 ?        S    May27   0:01 /usr/libexec/gdm-simple-greeter
gdm        2378  0.0  0.0 248768    40 ?        S    May27   0:00 /usr/libexec/polkit-gnome-authentication-agent-1
root       2386  0.0  0.1  52744   912 ?        S    May27   0:00 /usr/libexec/polkit-1/polkitd
gdm        2398  0.0  0.0 427608    40 ?        S<sl May27   0:00 /usr/bin/pulseaudio --start --log-target=syslog
rtkit      2400  0.0  0.0 168456   100 ?        SNl  May27   0:00 /usr/libexec/rtkit-daemon
root       2406  0.0  0.0 142248    40 ?        S    May27   0:00 pam: gdm-password
root      11745  0.0  0.0  11340    96 ?        S    May28   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data/mysql --pid-file
mysql     11923  0.0 40.4 1077016 196824 ?      Sl   May28   0:09 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/my
root      13218  0.0  0.1   9120   852 ?        S    04:23   0:00 /sbin/dhclient -d -4 -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pi
postfix   13236  0.0  0.2  81408  1400 ?        S    04:24   0:00 pickup -l -t fifo -u
root      13280  0.0  0.3 100448  1748 ?        Ss   04:24   0:00 sshd: [email protected]/0
root      13287  0.0  0.3 108472  1532 pts/0    Ss   04:24   0:00 -bash
root      13598  0.0  0.1  17420   644 ?        Ss   05:01   0:00 /usr/sbin/anacron -s
root      13729  4.0 14.0 2140400 68480 pts/0   Sl   05:32   0:02 /usr/java/latest/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.  

--- java传递具体的参数启动tomcat程序
root      13749  0.0  0.2 110240  1136 pts/0    R+   05:33   0:00 ps -aux
[[email protected] tomcat]#

验证:成功打开浏览器,

http://localhost:8080




一、tomcat的目录结构:
        bin: 脚本及启动时用到类;
        lib:类库;
        conf:配置文件;
        logs:日志文件;
        webapps:webapp的默认部署目录;
        work:工作目录;
        temp:临时文件目录;

二、tomcat的配置文件:

server.xml:主配置文件;
    context.xml:每个webapp都可以有专用的配置文件,这些配置文件通常位于webapp程序目录下的WEB-INF目录中,用于定义会话管理顺、JDBC等 ;conf/context.xml是为各webapp提供默认配置;
    web.xml:每个webapp只有在“部署”之后才能够被访问;此文件则用于为各webapps定义默认的部署操作方式;
    tomcat-users.xml:用户认证的账号和密码配置文件;
    catalina.policy:当使用-security选项来启动tomcat实例时会读取此配置文件来实现基于安全策略的运行方式;
    catalina.properties:Java属性的定义文件,用于设定类加载器路径等 ,以及一些与JVM性能相关的调优参数;
    logging.properties:日志系统相关的配置;

[[email protected] tomcat]# ll conf/
total 204
drwxr-xr-x. 3 root root   4096 May 29 05:32 Catalina
-rw-------. 1 root root  10572 Apr  2 00:29 catalina.policy
-rw-------. 1 root root   3765 Apr  2 00:29 catalina.properties
-rw-------. 1 root root   1395 Apr  2 00:29 context.xml
-rw-------. 1 root root   3290 Apr  2 00:29 logging.properties
-rw-------. 1 root root   6824 Apr  2 00:29 server.xml
-rw-------. 1 root root   1950 Apr  2 00:29 tomcat-users.xml
-rw-------. 1 root root 164845 Apr  2 00:29 web.xml
[[email protected] tomcat]#

三、tomcat的组件:
            <Server>
                <Service>
                    <connector/>
                    <connector/>
                    <Engine>
                        <Host />
                        <Host>
                            <Context/>
                            ...
                        </Host>
                    </Engine>
                </Service>
            </Server>

每个组件,均有java类来实现;
            
            此些组件可分为如下几类:
                顶级组件:Server
                服务类:Service
                连接器:http, https, ajp(apache jserv protocol)
                容器类:Engine, Host, Context
                被嵌套的组件:valve, logger, realm, loader, manager
                集群类组件:listener, ...

Java Webapp的组织结构:
    有特定的组织形式、层次型的目录结构;主要包含了servlet代码文件、JSP页面文件、类文件、部署描述符文件等 ;
        /:webapps的根目录
        index.jsp:jsp的主页面文件
        WEB-INF/:当前webapp的私有资源目录,通常存放当前webapp自用的web.xml;
        META-INF/:当前webapp的私有资源目录,通常存储当前webapp自用的context.xml;
        classes/: 当前webapp的私有类;
        lib/:当前webapp的私有类,被打包成jar格式;
        
    webapp归档格式:
        .war:webapp
        .jar:EJB的类;
        .rar:资源适配器;
        .ear:企业级应用程序;

[[email protected] tomcat]# cat conf/server.xml
<?xml version=‘1.0‘ encoding=‘utf-8‘?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">

<!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">
 
    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->
   
   
    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->          
    <!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

<!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

<!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

<!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">        
    -->
    <Engine name="Catalina" defaultHost="localhost">

<!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

<!-- The request dumper valve dumps useful debugging information about
           the request and response data received and sent by Tomcat.
           Documentation at: /docs/config/valve.html -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

<!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

<!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

<!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

<!-- Access log processes all example.
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
               prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
        -->

</Host>
    </Engine>
  </Service>
</Server>
[[email protected] tomcat]#

时间: 2024-10-22 06:11:52

linux-jdk安装,tomcat安装的相关文章

Linux系统下JDK和Tomcat安装配置

Linux系统下JDK安装配置 1. 从oracle网站下载需要的JDK软件 :jdk-6u39-linux-i586.bin http://www.oracle.com/technetwork/java/javase/archive-139210.html 然后通过FTP上传到linux服务器上. 2. 将文件copy到/usr目录下 [[email protected] wendy]# cp jdk-6u39-linux-i586.bin /usr/ 3. 给文件添加执行权限: [[emai

Linux搭建JDK、Tomcat安装及配置

一.JDK安装及配置 1.JKD下载地址:http://pan.baidu.com/s/1i5NpImx 2.查看安装: rpm -qa | grep jdk 3.卸载:rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.i686     rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686 4.上传JDK文件到Linux服务器 5.解压缩:tar -zxvf j

Linux下JDK和Tomcat安装

下载地址 http://www.oracle.com/technetwork/java/javase/downloads/index.html http://download.oracle.com/otn-pub/java/jdk/8u31-b13/jdk-8u31-linux-x64.tar.gz?AuthParam=1425274077_b32bf92a0bb67039ccba3e32e85fb356 查看环境变量 whereis java which java (java执行路径) ech

Linux上jdk,mysql,tomcat安装

一:RPM(红帽软件包管理器):相当于windows的添加/卸载程序(控制面板),进行程序的安装.更新.卸载.查看: 本地程序安装:rpm -ivh 程序名 本地程序查看:rpm -qa 本地程序卸载:rpm -e --nodeps 程序名 二:Yum 软件仓库:相当于可以联网的rpm命令,相当于先联网下载程序安装包.程序的更新包(Yum安装:sudo apt install yum) 准备工作: 因为JDK,TOMCAT,MYSQL的安装过程中需要从网上下载部分支持包才可以继续,所以先联网安装

Linux中进行jdk的安装+Tomcat安装+mysql的安装

1.上传所需要的文件(这里事先准备好了jdk和tomcat的安装包,mysql需要在线安装) jdk的安装包名称:jdk-8u151-linux-x64.tar.gz tomcat 的安装包名称:apache-tomcat-8.5.15.tar.gz 2.jdk安装:    检查是否有安装jdk和centos自带的jdk的卸载:    1.先查看centos自带的jdk:rpm -qa|grep java     2.卸载centos自带的jdk:rpm -e --nodeps centos自带

jdk和tomcat安装

jdk安装: jdk的下载地址可在google中直接搜索jdk,搜到的第一个链接地址应该就是oracle公司提供的jdk页面,点击进入官网页面,选中接受协议后选择要下载的软件包即可.如下图: 点击链接,进入下面界面. tar xf jdk-8u77-linux-x64.tar.gz mkdir /usr/local/app mv jdk1.8.0_77/ /usr/local/app cd /usr/local/app/ ln -s /usr/local/app/jdk1.8.0_77/ /us

为Linux上的Tomcat安装apr支持

在安装并配置好JDK和tomcat之后,就可以提供web的访问支持了,但是在启动的信息里面,会有相关的提示,说的意思就是要求你安装apr支持,而安装apr支持需要使用源代码一步一步来. 下面就请跟着我,使用源代码方式安装apr支持. 0.前提 ①请安装并配置好JDK和tomcat,并且创建链接文件,使得 /usr/java/jdk 相当于JDK的根目录 /usr/local/tomcat 相当于tomcat的根目录. ② 已经安装好了openssl的开发包,不管是源代码方式安装还是使用包管理器方

Linux下的Tomcat安装

1.JDK的安装 Tomcat是目前比较流行的Web应用服务器之一 首先安装JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 解压,移至/usr/local/下 设置环境变量:vim /etc/profile.d/java.sh JAVA_HOME=/usr/local/jdk1.8.0_101/ JAVA_BIN=/usr/local/jdk1.8.0_101/bin

linux环境下tomcat安装

1.安装tomcat前安装jdk(前提下) 2.下载安装包apache-tomcat-8.0.36.tar.gz    解压:tar -zxvf apache-tomcat-8.0.36.tar.gz 3.启动tomcat: 切换进入:apache-tomcat-8.0.36/bin,  启动:./startup.sh     关闭:./shutdown.sh 4.访问tomcat  验证安装成功: 输入http://192.168.9.117:8080/    当前服务器ip+端口访问  访问

JDK、Tomcat安装(CentOS 7)

1.安装JDK 下载压缩源码:jdk-8u181-linux-x64.tar.gz 解压源码:tar -zxvf jdk-8u181-liunx-x64.tar.gz 移动到/usr/local/jdk:mv jdk-8u181-liunx-x64 /usr/local/jdk jdk配置: 打开系统的环境变量配置文件:vi /etc/profile 在profile文件最后加入:## JAVA export JAVA_HOME=/usr/local/jdk export PATH=$PATH: