日期:2014-05-17  浏览次数:20667 次

RHEL AS4 安装 JDK6U3 TOMCAT APACHE
操作系统:
# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant)
安装文件(已都cp到/usr/local/src/):
jdk-6u3-linux-amd64-rpm.bin
apache-tomcat-6.0.14.tar.gz?
httpd-2.2.6.tar.gz??????????

1、安装JDK

文件名称:?????? jdk-6u3-linux-amd64-rpm.bin
文件大小:?????? 56.16MB
注:安装时候bin文件一定要在你Linux的分区上

?

#chmod +x jdk-6u3-linux-amd64-rpm.bin

# ./jdk-6u3-linux-amd64-rpm.bin

会问你:Do you agree to the above license terms? [yes or no]
当然要:yes

jdk安装在这里:/usr/java/jdk1.6.0_03

?

测试:
(1)用文本编辑器编辑HelloWorldApp.java,内容为:

class HelloWorldApp
{
public static void main (String args[])
{
System.out.println("Hello,World!");
}
}
(2)编译:#javac HelloWorldApp.java
(3)运行:#java HelloWorldApp
如果输出一行Hello,World!,说明安装配置成功!


?

安装TOMCAT需要先配置JDK/JRE环境变量。

?

编辑 /etc/profile 文件,添加如下内容:

JAVA_HOME=/usr/java/jdk1.6.0_03
PATH=$JAVA_HOME:$JAVA_HOME/bin:$PATH:$HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH JAVA_HOME CLASSPATH

?

验证一下:

# source ./profile
# echo $JAVA_HOME
/usr/java/jdk1.6.0_03


?

2、安装TOMCAT

文件名称:?????? apache-tomcat-6.0.14.tar.gz

文件大小:?????? 5.70MB

?

解压缩下载的包至/usr/local/下

#tar -zxvf apache-tomcat-6.0.14.tar.gz


# cd bin

# ./startup.sh
Using CATALINA_BASE:?? /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:?? /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:?????? /usr/java/jdk1.6.0_03

测试:

# netstat -tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address?????????????? Foreign Address???????????? State??????
tcp??????? 0????? 0 :::8009???????????????????? :::*??????????????????????? LISTEN
tcp??????? 0????? 0 :::8080???????????????????? :::*??????????????????????? LISTEN
tcp??????? 0????? 0 :::80?????????????????????? :::*??????????????????????? LISTEN

port 8080 and 8009已经LISTEN了

检查tomcat是否启动
# netstat -anp | grep :8080

?

打开浏览器,敲入主机地址和端口号8080,回车
如果出现小猫画面则说明,安装成功。

?

添加用户:

编辑tomcat目下的/conf/tomcat_user.xml文件???
? 比如<user?? username="admin"?? password="admin"?? roles="manager,admin"/>??

重启服务:

# ./shutdown.sh
Using CATALINA_BASE:?? /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:?? /usr/local/apache-tomcat-6.0.14
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using JRE_HOME:?????? /usr/java/jdk1.6.0_03
# ./startup.sh
Using CATALINA_BASE:?? /usr/local/apache-tomcat-6.0.14
Using CATALINA_HOME:?? /usr/local/apache-tomcat-6.0.14

Using CATALINA_TMPDIR: /usr/local/apache-tomcat-6.0.14/temp
Using