卸载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]#