码迷,mamicode.com
首页 > 系统相关 > 详细

Linux下的Tomcat安装

时间:2016-08-29 00:13:40      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:linux   centos   tomcat   jdk   

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

JRE_HOME=/usr/local/jdk1.8.0_101/jre

PATH=$PATH:/usr/local/jdk1.8.0_101/bin:/usr/local/jdk1.8.0_101/jre/bin

CLASSPATH=/usr/local/jdk1.8.0_101/jre/lib:/usr/local/jdk1.8.0_101/lib:/usr/local/jdk1.8.0_101/jre/lib/charsets.jar

export  JAVA_HOME  JAVA_BIN JRE_HOME  PATH  CLASSPATH

检测是否设置正确:

java -version


2.tomcat安装

http://archive.apache.org/dist/tomcat/

下载tomcat:

cd /usr/local/src

wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.57/bin/apache-tomcat-7.0.57.tar.gz

拷贝启动脚本并编辑:

mv apache-tomcat-7.0.57 /usr/local/tomcat

cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat

vim /etc/init.d/tomcat

# chkconfig: 112 63 37

# description: tomcat server init script

# Source Function Library

. /etc/init.d/functions


JAVA_HOME=/usr/local/jdk1.8.0_101/

CATALINA_HOME=/usr/local/tomcat


启动tomcat:

/etc/init.d/tomcat start


默认端口:192.168.237.130:8080


3.tomcat虚拟主机配置

cd /usr/local/tomcat/conf

vim server.xml

修改端口为80:

<Connector port="80" protocol="HTTP/1.1"

添加虚拟主机:

<Host name="www.123.cn" appBase="/data/tomcatweb"

    unpackWARs="false" autoDeploy="true"

    xmlValidation="false" xmlNamespaceAware="false">

    <Context path="" docBase="./" debug="0" reloadable="true" crossContext="true"/>

</Host>


本文出自 “模仿游戏” 博客,请务必保留此出处http://kevinjin117.blog.51cto.com/11655131/1843609

Linux下的Tomcat安装

标签:linux   centos   tomcat   jdk   

原文地址:http://kevinjin117.blog.51cto.com/11655131/1843609

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!