linux下安装jdk和tomcat
Linux下安装JDK和tomcat
首先把JDK和tomcat的安装文件copy到linux usr/local文件夹中
jdk安装文件名为:jdk-6u3-linux-i586-rpm.bin
tomcat的安装包为:apache-tomcat-6.0.14.tar.gz
安装JDK
使用 ./ 执行 jdk-6u3-linux-i586-rpm.bin文件:./jdk*
然后在接下来选择同意安装协议
JDK会进行解压缩,解压缩完成后在目录下会看到一些rpm文件,如下
[root@localhost local]# ls apache-tomcat-6.0.14.tar.gz sbin bin share etc src games sun-javadb-client-10.2.2-0.1.i386.rpm include sun-javadb-common-10.2.2-0.1.i386.rpm jdk-6u3-linux-i586.rpm sun-javadb-core-10.2.2-0.1.i386.rpm jdk-6u3-linux-i586-rpm.bin sun-javadb-demo-10.2.2-0.1.i386.rpm lib sun-javadb-docs-10.2.2-0.1.i386.rpm libexec sun-javadb-javadoc-10.2.2-0.1.i386.rpm
安装jdk*.rpm文件:rpm -ivh jdk*.rpm
[root@localhost local]# rpm -ivh jdk*.rpm Preparing... ########################################### [100%] package jdk-1.6.0_03-fcs.i586 is already installed
安装完成之后,我们在usr中可以看到生成了一个java文件夹
[root@localhost usr]# ls bin etc games include java kerberos lib lib64 libexec local sbin share src tmp X11R6
配置环境变量
查看环境变量:echo $PATH
设置环境变量:
打开文件:vi /etc/profile
设置变量:
JAVA_HOME=/usr/java/jdk1.6.0 CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:./ PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME CLASSPATH PATH
执行文件:source /etc/profile
查看JDK安装是否成功:
java -version javac -version
安装Tomcat
在usr/local目录下直接解压缩apache-tomcat-6.0.14.tar.gz
tar zxvf apache-tomcat-6.0.14.tar.gz
然后在该目录下就能看到生成了一个文件夹
[root@localhost local]# ls apache-tomcat-6.0.14 apache-tomcat-6.0.14.tar.gz bin etc games include lib libexec sbin share src
设置一个软链接:
[root@localhost local]# ln -sf /usr/local/apache-tomcat-6.0.14 /usr/local/tomcat
再次查看该目录,就会发现该目录下重新生成了一个tomcat的文件夹
[root@localhost local]# ls apache-tomcat-6.0.14 apache-tomcat-6.0.14.tar.gz bin etc games include lib libexec sbin share src tomcat
设置环境变量:
CATALINA_HOME=/usr/local/tomcat JAVA_HOME=/usr/java/jdk1.6.0 CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar:./ PATH=$JAVA_HOME/bin:$PATH export CATALINA_HOME JAVA_HOME CLASSPATH PATH
启动tomcat:
[root@localhost tomcat]# bin/startup.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0
停止tomcat:
[root@localhost tomcat]# bin/shutdown.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/jdk1.6.0
相关推荐
lonesomer 2020-09-17
Locksk 2020-10-12
佛系程序员J 2020-10-10
gdb 2020-09-14
zousongshan 2020-08-10
hell0kitty 2020-07-28
malonely 2020-07-20
missingmuch 2020-07-19
eternityzzy 2020-07-19
wangrui0 2020-06-28
一世为白 2020-06-21
MAC2007 2020-06-16
凉白开 2020-06-17
zhangwentaohh 2020-06-14
liangston 2020-06-14
linzb 2020-06-14
89421478 2020-06-12