Linux中安装Tomcat6手记
Ø 安装tomcat前先要保证安装了JDK,可以用命令查看是否安装了JDK:
[[email protected] webapps]# java -version
java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode, sharing)
Ø 下载Tomcat6的压缩包,文件名为:apache-tomcat-6.0.26.tar.gz ;
Ø 在 /usr/local目录下解压此压缩文件:
[[email protected] local]# tar xzvf apache-tomcat-6.0.26.tar.gz
之后生成一个名为“apache-tomcat-6.0.26”的文件夹, 安装的Tomcat目录。;
Ø 启动tomcat:
cd /usr/local/ apache-tomcat-6.0.26/bin
[[email protected] bin]# ./startup.sh
注:可以把安装的tomcat文件夹改个名字或者做个备份为tomcat6:
[[email protected] bin]# mv apache-tomcat-6.0.26 tomcat6
[[email protected] bin]# cp -r apache-tomcat-6.0.26 tomcat6
Ø 为tomcat添加环境变量:
[[email protected] ~]# more .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export JAVA_HOME=/usr/java/jdk1.6.0_19
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
export TOMCAT_HOME=/usr/local/tomcat6
Ø 查看测试页:
在其他机器上如果能ping通安装了tomcat的服务器地址,就应该能访问tomcat的测试页了,如在ie中直接访问:http://192.168.2.254:8080
Ø The End…