CentOS 6.5 64位环境下安装和配置tomcat

一、问题概述

本文主要讲述在CentOS 6.5  64位环境下安装tomcat的步骤和配置。安装tomcat之前要安装jdk,安装jdk的过程请参考上一篇。

二、安装tomcat

1、下载tomcat

  进入tomcat官网http://tomcat.apache.org/在官网左侧download一栏中选择tomcat7,选择下图红色圈出来的版本进行下载。

CentOS 6.5 64位环境下安装和配置tomcat_第1张图片

2、安装tomcat

[root@localhost ~]# cp /root/Desktop/apache-tomcat-7.0.72.tar.gz /usr/local
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-7.0.72.tar.gz  bin  etc  games  include  java8  jdk-8u111-linux-x64.tar.gz  lib  lib64  libexec  sbin  share  src
[root@localhost local]# tar xf apache-tomcat-7.0.72.tar.gz 
[root@localhost local]# ls
apache-tomcat-7.0.72  apache-tomcat-7.0.72.tar.gz  bin  etc  games  include  java8  jdk-8u111-linux-x64.tar.gz  lib  lib64  libexec  sbin  share  src
[root@localhost local]# mv apache-tomcat-7.0.72 tomcat7
[root@localhost local]# ls
apache-tomcat-7.0.72.tar.gz  bin  etc  games  include  java8  jdk-8u111-linux-x64.tar.gz  lib  lib64  libexec  sbin  share  src  tomcat7
              

3、配置

[root@localhost local]# ln -s tomcat7 tomcat
[root@localhost local]# ls
apache-tomcat-7.0.72.tar.gz  bin  etc  games  include  java8  jdk-8u111-linux-x64.tar.gz  lib  lib64  libexec  sbin  share  src  tomcat  tomcat7
[root@localhost local]# cp tomcat/bin/catalina.sh /etc/init.d/tomcat
[root@localhost local]# vi /etc/init.d/tomcat

在第二行添加如下内容:

# chkconfig:2345 63 37
# description: tomcat server init script
# Source Function Library
./etc/init.d/functions
JAVA_HOME=/usr/local/java8
CATALINA_HOME=/usr/local/tomcat

编辑完成后,修改文件权限,并添加到开机启动

[root@localhost local]# chmod 754 /etc/init.d/functions
[root@localhost local]# chmod 755 /etc/init.d/tomcat
[root@localhost local]# chkconfig --add tomcat
[root@localhost local]# chkconfig tomcat on

4、测试

启动tomcat服务,并设置端口

[root@localhost local]# service tomcat start
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME:        /usr/local/java8
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
[root@localhost local]# ss -tunlp | grep -v grep | grep 8080
tcp    LISTEN     0      100                   :::8080                 :::*      users:(("java",2638,46))

你可能感兴趣的:(centos,tomcat,64位)