2.#tar -zxvf apache-tomcat-6.0.35.tar.gz ;//解压
3.#cp -R apache-tomcat-6.0.35 /usr/tomcat ;//拷贝到/usr/下并重命名为tomcat
4.#/usr/tomcat/bin/startup.sh; //启动tomcat
显示
Using CATALINA_BASE: /usr/tomcat
Using CATALINA_HOME: /usr/tomcat
Using CATALINA_TMPDIR: /usr/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.7.0_04
Using CLASSPATH: /usr/tomcat/bin/bootstrap.jar
到此tomcat已经安装完成,现在使用浏览器访问 http://localhost:8080 ,出现tomcat默认页面,说明已经安装成功。
5.# #/usr/tomcat/bin/shutdown.sh; //关闭tomcat
显示
Using CATALINA_BASE: /usr/tomcat
Using CATALINA_HOME: /usr/tomcat
Using CATALINA_TMPDIR: /usr/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.7.0_04
Using CLASSPATH: /usr/tomcat/bin/bootstrap.jar
也可以用脚本实现自动 安装:
将以下install_tomcat6.sh放在apache-tomcat-6.0.36.tar.gz相同的目录
#!/bin/bash
file="apache-tomcat-6.0.36.tar.gz"
prefix="apache-tomcat-6.0.36"
install_path="/usr/tomcat"
tar -zvxf ${prefix}.tar.gz
if [ ! -d ${install_path} ]; then
mkdir -p ${install_path}
echo "[ info ] mkdir ${install_path}"
fi
cp -R ${prefix} ${install_path}
echo "[ info ] ${prefix} has installed :)"
${install_path}/${prefix}/bin/startup.sh
echo "[ info ] ${prefix} is running....."
rpm -q firefox
firefox "http://localhost:8080"