卸载rpm包安装的jdk(jdk无法安装),由于手工删除了它安装目录

文字简述
1、jdk是以rpm包形式安装的,但是手工删除了它安装目录
2、再次安装就遇到问题了,提示已经安装了
3、以替换软件包形式安装,不确定包是否完整 
4、最后采用yum remove卸载,然后重新安装即可
注意:不要采用删除软件包的方式卸载,会卸载不干净

卸载rpm包安装的jdk过程
1、jdk是以rpm包形式安装的

但是手工删除了它安装目录

[root@dawn-jump-1-2 /tools]# cd /usr/java/
[root@dawn-jump-1-2 /usr/java]# ls
default  jdk1.8  jdk1.8.0_111  latest
[root@dawn-jump-1-2 /usr/java]# rpm -qf latest/
file /usr/java/latest is not owned by any package
[root@dawn-jump-1-2 /usr/java]# ls -al
total 0
drwxr-xr-x   3 root root  69 Jul 26 08:58 .
drwxr-xr-x. 14 root root 167 Sep 23  2016 ..
lrwxrwxrwx   1 root root  16 Jul 26 08:57 default -> /usr/java/latest
lrwxrwxrwx   1 root root  12 Jul 26 08:58 jdk1.8 -> jdk1.8.0_111
drwxr-xr-x   9 root root 268 Jul 26 08:57 jdk1.8.0_111
lrwxrwxrwx   1 root root  22 Jul 26 08:57 latest -> /usr/java/jdk1.8.0_111
[root@dawn-jump-1-2 /usr/java]# rm -rf jdk1.8.0_111/
[root@dawn-jump-1-2 /usr/java]# ls
default  jdk1.8  latest
[root@dawn-jump-1-2 /usr/java]# ls -al
total 0
drwxr-xr-x   2 root root  49 Jul 26 10:07 .
drwxr-xr-x. 14 root root 167 Sep 23  2016 ..
lrwxrwxrwx   1 root root  16 Jul 26 08:57 default -> /usr/java/latest
lrwxrwxrwx   1 root root  12 Jul 26 08:58 jdk1.8 -> jdk1.8.0_111
lrwxrwxrwx   1 root root  22 Jul 26 08:57 latest -> /usr/java/jdk1.8.0_111
[root@dawn-jump-1-2 /usr/java]# rm -rf *
[root@dawn-jump-1-2 /usr/java]# ls

2、再次安装就遇到问题了,提示已经安装了

[root@dawn-jump-1-2 /tools]# ls -lh
total 168M
-rw-r--r-- 1 root root 9.1M Sep 28  2017 apache-tomcat-8.5.23.tar.gz
-rw-r--r-- 1 root root 159M Dec 22  2016 jdk-8u111-linux-x64.rpm
drwxr-xr-x 9 root root  160 Jul 26 09:01 tomcat
[root@dawn-jump-1-2 /tools]# rpm -ivh jdk-8u111-linux-x64.rpm 
Preparing...                          ################################# [100%]
	package jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64 is already installed
[root@dawn-jump-1-2 /tools]# cd /usr/java/
[root@dawn-jump-1-2 /usr/java]# ls

以替换软件包形式安装,提示如下

[root@dawn-jump-1-2 /tools]# ls
apache-tomcat-8.5.23.tar.gz  jdk-8u111-linux-x64.rpm  tomcat
[root@dawn-jump-1-2 /tools]# rpm -ivh --replacepkgs jdk-8u111-linux-x64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_111-2000:1.8.0_111-fcs  ################################# [100%]
Unpacking JAR files...
	tools.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/lib/tools.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/lib/tools.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	plugin.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/plugin.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/plugin.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	javaws.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/javaws.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/javaws.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	deploy.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/deploy.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/deploy.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	rt.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/rt.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/rt.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	jsse.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/jsse.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/jsse.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	charsets.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/charsets.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/charsets.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
	localedata.jar...
Error: Could not open input file: /usr/java/jdk1.8.0_111/jre/lib/ext/localedata.pack
Error: unpack could not create JAR file:

	/usr/java/jdk1.8.0_111/jre/lib/ext/localedata.jar

Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
[root@dawn-jump-1-2 /tools]# cd /usr/java/
[root@dawn-jump-1-2 /usr/java]# ls
default  jdk1.8.0_111  latest

不确定包是否完整

3、最后采用yum remove卸载,然后重新安装即可

看来以后不能采用删除软件包的方式

[root@dawn-jump-1-2 /tools]# yum -y remove jdk1.8.0_111.x86_64 
Loaded plugins: fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Resolving Dependencies
--> Running transaction check
---> Package jdk1.8.0_111.x86_64 2000:1.8.0_111-fcs will be erased
--> Finished Dependency Resolution
base/7/x86_64                                                                                                                         | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                                                  | 7.5 kB  00:00:00     
epel/x86_64                                                                                                                           | 3.2 kB  00:00:00     
epel/x86_64/updateinfo                                                                                                                | 928 kB  00:00:00     
epel/x86_64/primary                                                                                                                   | 3.5 MB  00:00:05     
extras/7/x86_64                                                                                                                       | 3.4 kB  00:00:00     
updates/7/x86_64                                                                                                                      | 3.4 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                                           | 4.3 MB  00:00:05     

Dependencies Resolved

=============================================================================================================================================================
 Package                               Arch                            Version                                      Repository                          Size
=============================================================================================================================================================
Removing:
 jdk1.8.0_111                          x86_64                          2000:1.8.0_111-fcs                           installed                          258 M

Transaction Summary
=============================================================================================================================================================
Remove  1 Package

Installed size: 258 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Erasing    : 2000:jdk1.8.0_111-1.8.0_111-fcs.x86_64                                                                                                    1/1 
  Verifying  : 2000:jdk1.8.0_111-1.8.0_111-fcs.x86_64                                                                                                    1/1 

Removed:
  jdk1.8.0_111.x86_64 2000:1.8.0_111-fcs                                                                                                                     

Complete!
[root@dawn-jump-1-2 /tools]# rpm -ivh jdk-8u111-linux-x64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_111-2000:1.8.0_111-fcs  ################################# [100%]
Unpacking JAR files...
	tools.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...
	rt.jar...
	jsse.jar...
	charsets.jar...
	localedata.jar...
[root@dawn-jump-1-2 /tools]# ls /usr/java/
default  jdk1.8.0_111  latest
[root@dawn-jump-1-2 /tools]# 

原文链接:https://www.likecs.com/show-942941.html
原文链接:https://www.cnblogs.com/nmap/articles/9371855.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值