jdk的几种安装方式
一、rpm安装jdk-7-linux-i586.rpm
[root@localhost ~]# rpm -ivh jdk-7-linux-i586.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
[root@localhost local]# vim /etc/profile 在最后一行添加如下行
JAVA_HOME="/root/jdk-7"
export JAVA HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
[root@localhost local]# source /etc/profile 执行生效
二、.bin安装jdk-6u20-linux-i586.bin
[root@localhost ~]# chmod +x jdk-6u20-linux-i586.bin
[root@localhost ~]# ./jdk-6u20-linux-i586.bin
按空格键直到出现下行
Do you agree tothe above license terms? [yes or no] //这里选同意啦
yes //输入yes
解压文件………
……………………………..
Press Enter to continue..... //提示你按回车键继续
Done .
[root@localhost ~]# ls 查看安装后的文件
anaconda-ks.cfg install.log jdk-6u20-linux-i586.bin
install.log.syslog Desktop jdk1.6.0_20
[root@localhost local]# vim /etc/profile 在最后一行添加如下行
JAVA_HOME="/root/jdk1.6.0_20" 写jdk解压路径
export JAVA HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
[root@localhost local]# source /etc/profile 执行生效
三、tar安装jdk-7-linux-i586.gz apache-tomcat-7.0.23.tar.gz压缩包
[root@localhost ~]# ls
anaconda-ks.cfg Desktop install.log.syslog
apache-tomcat-7.0.23.tar.gz install.log jdk-7-linux-i586.gz
[root@localhost ~]# tar xvf jdk-7-linux-i586.gz -C /usr/local/ jdk解压即可
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin etc games include jdk1.7.0 lib lib64 libexec sbin share src 看好解压的jdk格式
[root@localhost local]# vim /etc/profile 在最后一行添加如下行
JAVA_HOME="/usr/local/jdk1.7.0"
export JAVA HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
[root@localhost local]# source /etc/profile 执行生效
[root@localhost local]# java –version 测试java是否安装成功,出现版本信息证明成功
java version "1.6.0"
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09,mixed mode)
[root@localhost local]# cd
[root@localhost ~]# tar xvf apache-tomcat-7.0.23.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apache-tomcat-7.0.23 etc include lib libexec share
bin games jdk1.7.0 lib64 sbin src
[root@localhost local]# mv apache-tomcat-7.0.23/ tomcat 将解压文件改名为tomcat
[root@localhost local]#tomcat/bin/startup.sh 启动tomcat
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR:/usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@localhost local]# netstat -anpl |grep java 查看jkd是否启动
tcp 0 0::ffff:127.0.0.1:8005 :::* LISTEN 4288/java
tcp 0 0 :::8009 :::* LISTEN 4288/java
tcp 0 0 :::8080 :::* LISTEN 4288/java
访问http://本机ip:8080,出现猫为成功