tomcat安装

1. Tomcat安装
1.1 软件准备
因为jdk和Tomcat的版本对运维来说没什么区别,提供本文使用的软件下载地址:http://pan.baidu.com/s/1IpioA
2.2 部署java环境 (getconf LONG_BIT)查看系统位数
    [root@tomcat ~]# cd /application/tools/
    tar xf jdk-8u60-linux-x64.tar.gz -C /application/
    ln -s /application/jdk1.8.0_60 /application/jdk
    sed -i '$a export JAVA_HOME=/application/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar' /etc/profile
    source /etc/profile
    #→出现下面结果证明部署成功
    [root@tomcat ~]# java -version
    java version "1.8.0_60"
    Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
    Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
2.3 安装Tomcat
    tar xf apache-tomcat-8.0.27.tar.gz -C /application/
    ln -s /application/apache-tomcat-8.0.27 /application/tomcat
    echo 'export TOMCAT_HOME=/application/tomcat'>>/etc/profile
    source /etc/profile
    chown -R root.root /application/jdk/ /application/tomcat/
    [root@tomcat ~]# tail -4 /etc/profile
    export JAVA_HOME=/application/jdk
    export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
    export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
    export TOMCAT_HOME=/application/tomcat
2.4 Tomcat目录介绍
    [root@tomcat ~]# cd /application/tomcat/
    [root@tomcat tomcat]# tree -L 1
    .
    ├── bin #→用以启动、关闭Tomcat或者其它功能的脚本(.bat文件和.sh文件)
    ├── conf #→用以配置Tomcat的XML及DTD文件
    ├── lib #→存放web应用能访问的JAR包
    ├── LICENSE
    ├── logs #→Catalina和其它Web应用程序的日志文件
    ├── NOTICE
    ├── RELEASE-NOTES
    ├── RUNNING.txt
    ├── temp #→临时文件
    ├── webapps #→Web应用程序根目录
    └── work #→用以产生有JSP编译出的Servlet的.java和.class文件
    7 directories, 4 files
    [root@tomcat tomcat]# cd webapps/
    [root@tomcat webapps]# ll
    total 20
    drwxr-xr-x 14 root root 4096 Oct 5 12:09 docs #→tomcat帮助文档
    drwxr-xr-x 6 root root 4096 Oct 5 12:09 examples #→web应用实例
    drwxr-xr-x 5 root root 4096 Oct 5 12:09 host-manager #→管理
    drwxr-xr-x 5 root root 4096 Oct 5 12:09 manager #→管理
    drwxr-xr-x 3 root root 4096 Oct 5 12:09 ROOT #→默认网站根目录
2.5 启动Tomcat
    #→启动程序/application/tomcat/bin/startup.sh
    #→关闭程序/application/tomcat/bin/shutdown.sh
    [root@tomcat ~]# /application/tomcat/bin/startup.sh
    Using CATALINA_BASE: /application/tomcat
    Using CATALINA_HOME: /application/tomcat
    Using CATALINA_TMPDIR: /application/tomcat/temp
    Using JRE_HOME: /application/jdk
    Using CLASSPATH: /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar
    Tomcat started.
    [root@tomcat ~]# netstat -tunlp|grep java
    tcp 0 0 :::8009 :::* LISTEN 4743/java 
    tcp 0 0 :::8080 :::* LISTEN 4743/java 
    [root@tomcat ~]# ps -ef|grep [j]ava
    root 4743 1 17 06:10 pts/0 00:00:03 /application/jdk/bin/java -Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/application/tomcat/endorsed -classpath /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -Djava.io.tmpdir=/application/tomcat/temp org.apache.catalina.startup.Bootstrap start
2.6 访问网站
 
posted @ 2017-11-22 15:12  西门运维  阅读(223)  评论(0编辑  收藏  举报