【原创】linux下安装配置JDK+tomcat+mysql详细步骤

2013-02-07  付民 

1、安装linux系统:

RHEL5.1-Server-2007    下载地址:http://www.test-life.org/?p=383

2、linux安装完毕后,启动系统;本次安装mysql是通过在线安装的,打开终端:

[root@localhost ~]# yum install mysql

结果提示:This system is not registered with RHN,原因是安装的linux系统是redhat的。

解决方法:http://www.test-life.org/?p=465,这篇文章中有详细的安装方法;

3、JDK安装配置:

1)下载JDK安装包: jdk-6u27-linux-i586.bin

[root@localhost ~]# chmod a+x jdk-6u27-linux-i586.bin

[root@localhost ~]#./jdk-6u27-linux-i586.bin

如图到这了,按回车键即可:

 

2)把jdk安装在/usr/local目录里面

[root@localhost ~]#mv jdk1.6.0_27/  /usr/local/

3)建立一个连接,进入/usr/local目录下:

[root@localhost local]#ln –s  /usr/local/jdk1.6.0_27  /usr/local/jdk1.6

4)配置JDK环境变量,编辑/etc/profile目录下的profile文件:

[root@localhost local]#vim /etc/profile

在profile文件中加入如下内容:

JAVA_HOME=/usr/local/jdk1.6
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib
#JRE_HOME=$JAVA_HOME/jre
TOMCAT_HOME=/usr/local/tomcat6.0
export JAVA_HOME PATH CLASSPATH TOMCAT_HOME

保存,退出编辑。

5)测试JDK安装:

[root@localhost local]# java -version

信息显示如下:

java version “1.4.2″
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

4、tomcat安装配置:

1)进入/root/tomcat目录下

下载tomcat安装包到tomcat目录下:apache-tomcat-6.0.36.tar.gz

[root@localhost tomcat]# tar -zxvf  apache-tomcat-6.0.36.tar.gz

[root@localhost tomcat]#mv apache-tomcat-6.0.36 /usr/local/    //把tomcat安装到/usr/local目录下

[root@localhost local]# ln  -s  /usr/local/apache-tomcat-6.0.36   /usr/local/tomcat6.0   //进入/usr/local目录下创建一个连接

2)配置tomcat的环境变量,编辑/etc/profile文件

[root@localhost local]#vim /etc/profile

加入如下内容:

TOMCAT_HOME=/usr/local/tomcat6.0
CATALINA_HOME=/usr/local/tomcat6.0
CATLINA_BASE=/usr/local/tomcat6.0
export TOMCAT_HOME CATALINA_HOME CATALINA_BASH

保存,退出编辑。

3)重新载入profile文件

[root@localhost local]#source /etc/profile

5、检查环境变量配置

[root@localhost local]# echo $JAVA_HOME
/usr/local/jdk1.6
[root@localhost local]# echo $TOMCAT_HOME
/usr/local/tomcat6.0
[root@localhost local]# echo $CLASSPATH
.:/usr/local/jdk1.6/lib/dt.jar:/usr/local/jdk1.6/lib/tools.jar:/usr/local/jdk1.6/lib
[root@localhost local]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/jdk1.6/bin:/root/bin:/usr/local/jdk1.6/bin

6、查看JAVA的版本

[root@localhost local]# java -version

java version “1.5.0_14″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)

7、启动tomcat

[root@localhost local]# sh /usr/local/tomcat6.0/bin/startup.sh

Using CATALINA_BASE: /usr/local/tomcat6.0

Using CATALINA_HOME: /usr/local/tomcat6.0
Using CATALINA_TMPDIR: /usr/local/tomcat6.0/temp
Using JRE_HOME: /usr/local/jdk1.6
Using CLASSPATH: /usr/local/tomcat6.0/bin/bootstrap.jar

[root@localhost local]# netstat -ntl |grep 8080
tcp 0 0 :::8080 :::* LISTEN        //tomcat8080端口

8、在地址栏里输入http://IP:8080

 

 

 

 

 

此时tomcat安装成功。

9、验证效果吧,在/tomcat6.0/webapps目录下,新建web文件夹,写个index.html文件。

先把redhat linux防火墙关闭:

[root@localhost local]#/etc/rc.d/init.d/iptables stop

地址栏里输入:http://192.168.1.104:8080/web/index.html

ok了,验证通过。

 

本文固定链接: http://www.test-life.org/?p=471 | 测试之路-My Test Space

419°/4198 人阅读/0 条评论 发表评论

登录 后发表评论