目前最新版本是JDK 6 Update 17,請到此下載。
安裝JDK,回答完Yes的版權問題後, 開始自動解壓縮並安裝RPM
sh jdk-6u17-linux-i586-rpm.bin
新增path在/etc/profile (順便把tomcat的路徑設定上去)
#vi /etc/profile
##Java Environment
export JAVA_HOME=/usr/java/jdk1.6.0_21
export JAVA_OPTS="$JAVA_OPTS -Xmx512M -Dcom.sun.management.jmxremote"
export PATH=$JAVA_HOME/bin:$PATH
export CATALINA_HOME=/root/soft/apache-tomcat-6.0.24
export CATALINA_BASE=/root/soft/apache-tomcat-6.0.24
export CLASSPATH=./:${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib/ext:${CATALINA_HOME}/common/lib
export JAVA_HOME JAVA_BIN PATH CLASSPATH
需要哪些环境变量/root/soft/apache-tomcat-6.0.24/bin/catalina.sh文件中看,这个路径是你的Tomcat的解压路径
2 安装Tomcat
解压运行 sh /usr/local/apache-tomcat-6.0.26/bin/startup.sh启动tomcat
得到如下输出则启动成功
[root@Linux-Fedora bin]# sh startup.sh
Using CATALINA_BASE: /usr/local/apache-tomcat-6.0.26
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.26
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.26/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/apache-tomcat-6.0.26/bin/bootstrap.jar
在浏览器中输入127.0.0.1:8080就能看见tomcat的启动页了
要进入tomcat的manager,需要修改conf目录下tomcat-users.xml。
内容类似如下:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="用户名" password="密码" roles="admin,manager"/>
</tomcat-users>