1.1. JDK 1.7
1) root用户建立 /usr/java 目录
mkdir /usr/java
2) ftp上传 jdk安装包至 /usr/java目录
3) 安装jdk rpm包
[[email protected] java]# rpm -ivh jdk-7u71-linux-x64.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...
4) 确认jdk环境安装正确
[[email protected] bin]# ./java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
[[email protected] bin]#
5) 配置服务器全局环境变量
vi /etc/profile
增加配置信息
export JAVA_HOME=/usr/java/jdk1.7.0_71
export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
6) 重新登陆后生效
Last login: Thu May 14 18:07:34 2015 from 192.168.1.247
[[email protected] ~]# java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
[[email protected] ~]#