linux安装jdk1.8(rpm方式)

原文链接:http://blog.csdn.net/u010392801/article/details/52085394

1   //创建目录

mkdir /usr/java

2   rpm 包下载,--no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"参数必须加上,不然无法安装

[root@cs7 ~]# cd /usr/java
[root@cs7 java]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.

3   修改 rpm 包为可执行

[root@cs7 java]# chmod +x jdk-8u152-linux-x64.rpm
[root@cs7 java]# ll
-rwxr-xr-x. 1 root root 174192082 10月 10 06:05 jdk-8u152-linux-x64.rpm

4   进行安装

[root@cs7 java]# rpm -ivh jdk-8u152-linux-x64.rpm

5   验证安装是否完成

[root@cs7 java]# java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

附:卸载

[root@cs7 java]# find / -name "*jdk*"
/usr/java/jdk-8u131-linux-x64.rpm
/usr/java/jdk1.8.0_131
/usr/java/jdk1.8.0_131/lib/visualvm/profiler/lib/deployed/jdk15
/usr/java/jdk1.8.0_131/lib/visualvm/profiler/lib/deployed/jdk16
[root@cs7 java]# rpm -e --nodeps jdk1.8.0_131
[root@cs7 java]# find / -name "*jdk*"
/usr/java/jdk-8u131-linux-x64.rpm
[root@cs7 java]#

 

发表评论

zh_CNChinese
zh_CNChinese