1.
下载
Tomcat
http://tomcat.apache.org/download-60.cgi
选定
Tomcat6
对应的系统版本,这里针对
linux/unix
系统
,
选择下载得到的文件是:
apache-tomcat-6.0.32.tar.gz
2
.创建
Tomcat
安装目录。
在
Linux
系统硬盘系统文件夹
usr
下创建一个文件夹
tomcat
。
命令:
sudo mkdir tomcat
3
.复制
Tomcat
安装包到系统指定文件夹
。
把下载的安装文件(
apache-tomcat-6.0.32.tar.gz
)
拷到
linux
路径
/usr/tomcat
下。
4
安装
Tomcat
。
在当前
/usr/tomcat
下
开始安装
,
执行命令
: tar -zxvf apache-tomcat-6.0.32.tar.gz
(
如果因权限问题执行失败,则加上
sudo
,
即
sudo
tar
-zxvf apache-tomcat-6.0.32.tar.gz
)
文件会被安装到当前目录
/usr/tomcat/apache-tomcat-6.0.32
5
.给
apache-tomcat-6.0.32
文件夹加读写权限
sudo chmod -R o+rw
apache-tomcat-6.0.32
6.
指定
JDK
路径指定到
Tomcat
,非常关键的一步
在
/usr/tomcat/apache-tomcat-6.0.32/setclasspath.sh
文件中,加上红色的两行,目的是引用
JDK
的环境变量,之前的
JDK
设置环境变量(
JAVA_HOME,JRE_HOME
)很奇怪不能调用,
,
找了很多资料,重新
export
就
OK
了。
vi setclasspath.sh
#!/bin/sh
# 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.
# -----------------------------------------------------------------------------
#
Set CLASSPATH and Java options
#
#
$Id: setclasspath.sh 795037 2009-07-17 10:52:16Z markt $
#
-----------------------------------------------------------------------------
export JAVA_HOME=/usr/java/jdk1.6.0_24
export JRE_HOME=/usr/java/jdk1.6.0_24/jre
# Make sure prerequisite environment
variables are set
if [ -z "$JAVA_HOME" -a -z
"$JRE_HOME" ]; then
#
Bugzilla 37284 (reviewed).
if
$darwin; then
if [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
]; then
export
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home"
fi
else
JAVA_PATH=`which java 2>/dev/null`
if [ "x$JAVA_PATH" != "x" ]; then
JAVA_PATH=`dirname $JAVA_PATH 2>/dev/null`
JRE_HOME=`dirname $JAVA_PATH 2>/dev/null`
fi
if [ "x$JRE_HOME" = "x" ]; then
# XXX: Should we try other locations?
if [ -x /usr/bin/java ]; then
JRE_HOME=/usr
fi
fi
fi
if
[ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
echo "Neither the JAVA_HOME nor the JRE_HOME environment variable
is defined"
echo "At least one of these environment variable is needed to run
this program"
exit 1
fi
fi
if [ -z "$JAVA_HOME" -a
"$1" = "debug" ]; then
echo "JAVA_HOME should point to a JDK in order to run in debug
mode."
exit 1
fi
if [ -z "$JRE_HOME" ]; then
JRE_HOME="$JAVA_HOME"
fi
# If we're running under jdb, we need a
full jdk.
if [ "$1" = "debug" ] ;
then
if
[ "$os400" = "true" ]; then
if [ ! -x "$JAVA_HOME"/bin/java -o ! -x
"$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined
correctly"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
fi
else
if [ ! -x "$JAVA_HOME"/bin/java -o ! -x
"$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
echo "The JAVA_HOME environment variable is not defined
correctly"
echo "This environment variable is needed to run this program"
echo "NB: JAVA_HOME should point to a JDK not a JRE"
exit 1
fi
fi
fi
if [ -z "$BASEDIR" ]; then
echo "The BASEDIR environment variable is not defined"
echo "This environment variable is needed to run this program"
exit 1
fi
if [ ! -x
"$BASEDIR"/bin/setclasspath.sh ]; then
if
$os400; then
#
-x will Only work on the os400 if the files are:
#
1. owned by the user
#
2. owned by the PRIMARY group of the user
#
this will not work if the user belongs in secondary groups
eval
else
echo "The BASEDIR environment variable is not defined
correctly"
echo "This environment variable is needed to run this program"
exit 1
fi
fi
# Don't override the endorsed dir if the user
has set it previously
if [ -z "$JAVA_ENDORSED_DIRS" ];
then
#
Set the default -Djava.endorsed.dirs argument
JAVA_ENDORSED_DIRS="$BASEDIR"/endorsed
fi
# OSX hack to CLASSPATH
JIKESPATH=
if [ `uname -s` = "Darwin" ]; then
OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
if
[ -d "$OSXHACK" ]; then
for i in "$OSXHACK"/*.jar; do
JIKESPATH="$JIKESPATH":"$i"
done
fi
fi
# Set standard commands for invoking Java.
_RUNJAVA="$JRE_HOME"/bin/java
if [ "$os400" != "true"
]; then
_RUNJDB="$JAVA_HOME"/bin/jdb
Fi
7
.启动测试
在
/usr/tomcat/apache-tomcat-6.0.32/bin
路径下
a)
在控制台输入:
./startup.sh
以下是输出信息:
Using CATALINA_BASE:
/usr/tomcat/apache-tomcat-6.0.32
Using CATALINA_HOME:
/usr/tomcat/apache-tomcat-6.0.32
Using CATALINA_TMPDIR:
/usr/tomcat/apache-tomcat-6.0.32/temp
Using JRE_HOME:
/usr/java/jdk1.6.0_24/jre
Using CLASSPATH:
/usr/tomcat/apache-tomcat-6.0.32/bin/bootstrap.jar
b)
用
http://192.168.1.102:8080
访问
(192.168.1.102
是我的系统
IP)
如果访问成功,则
Tomcat
基本的配置已成功。
c)
简单测试了一个编译好的应用程序放到
webapps
文件夹下
,
测试成功
d)
关闭
tomcat,
执行命令:
./
shutdown.sh
以下是输出信息:
Using CATALINA_BASE:
/usr/tomcat/apache-tomcat-6.0.32
Using CATALINA_HOME:
/usr/tomcat/apache-tomcat-6.0.32
Using CATALINA_TMPDIR:
/usr/tomcat/apache-tomcat-6.0.32/temp
Using JRE_HOME:
/usr/java/jdk1.6.0_24/jre
Using CLASSPATH:
/usr/tomcat/apache-tomcat-6.0.32/bin/bootstrap.jar
分享到:
相关推荐
### Linux下安装Tomcat #### 知识点一:Tomcat简介 Apache Tomcat是一款开源的Servlet容器,由Apache Jakarta项目开发。它提供了一个纯Java环境来运行Java Servlet和JavaServer Pages (JSP)。Tomcat是Apache软件...
tomcat安装及配置教程tomcat安装及配置教程资源合集+Linux下安装Tomcat步骤详解+tomcat配置(免安装及安装版)之间有什么区别tomcat安装及配置教程资源合集+Linux下安装Tomcat步骤详解+tomcat配置(免安装及安装版)之间...
### Linux下安装Tomcat步骤详解 #### 一、前言 Tomcat是一个广泛使用的轻量级Web服务器和Servlet容器,由Apache基金会维护和支持。它支持最新的Servlet和JSP规范,并且由于其开源特性,得到了广泛的社区支持和发展...
linux下安装tomcat简单介绍,介绍linux下安装tomcat的注意事项及问题的解决方法
### Linux下安装Tomcat7详细步骤与注意事项 #### 一、前言 在Linux环境下部署应用服务器是非常常见的操作,特别是对于Java应用程序来说,Tomcat作为一款轻量级且功能强大的Servlet容器,被广泛应用于各种场景之中。...
### Linux下安装Tomcat8.0.45知识点详述 #### 一、前期准备与环境搭建 **1.1 下载与传输** - **下载JDK与Tomcat**: 在开始之前,首先需要确保已经从官方网站下载了所需版本的JDK(本例中为1.8.0_151)以及Tomcat...
本文将详细介绍如何在Linux平台下安装和部署Tomcat服务器,以及如何将Java Web应用部署到Tomcat服务器上。涵盖的知识点包括环境变量配置、启动端口配置、Tomcat服务器的启动和关闭、Java Web应用的部署等。 一、 ...
linux下安装 jdk和 tomcat 详解,详细的指令,自己总结,希望能帮到大家
以上步骤详细介绍了在Linux环境下安装和配置Tomcat的过程。确保每个步骤都正确执行,以保证Tomcat能正常运行。如果在安装过程中遇到任何问题,应检查错误消息或查阅相关文档以获得解决方案。在实际操作中,还可能...
### Linux下安装TomCat #### 一、简介 在Linux环境下部署Java Web应用程序时,Apache Tomcat是一个常用的应用服务器。本文档将详细介绍如何在Linux系统上安装并配置TomCat。 #### 二、下载TomCat 1. **访问...
在Linux环境下部署Java应用服务,通常需要先安装Java Development Kit(JDK)和Apache Tomcat。以下是关于在Linux上安装JDK和Tomcat的详细步骤。 **JDK安装与配置** 1. **检查JDK是否已安装**:通过运行`java -...
在IT领域,特别是对于Web应用开发人员而言,掌握在Linux环境下安装配置Apache Tomcat服务器是一项基本而重要的技能。本文将详细解析如何在Linux系统中安装并配置Tomcat,包括安装JDK(Java Development Kit)作为...