[root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# rpm -qa | grep jdk jdk1.8-1.8.0_271-fcs.x86_64
[root@localhost ~]# cd /home/Software/JDK/ [root@localhost JDK]# ls jdk-8u301-linux-x64.rpm
[root@localhost JDK]# sudo yum install -y jdk-8u301-linux-x64.rpm Loaded plugins: fastestmirror, langpacks Examining jdk-8u301-linux-x64.rpm: 2000:jdk1.8-1.8.0_301-fcs.x86_64 Marking jdk-8u301-linux-x64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package jdk1.8.x86_64 2000:1.8.0_301-fcs will be installed --> Finished Dependency Resolution Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error" Dependencies Resolved ================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================== Installing: jdk1.8 x86_64 2000:1.8.0_301-fcs /jdk-8u301-linux-x64 253 M Transaction Summary ================================================================================================================================================================== Install 1 Package Total size: 253 M Installed size: 253 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows: icedtea-web-1.7.1-2.el7_6.x86_64 has missing requires of java-1.8.0-openjdk jline-1.0-8.el7.noarch has missing requires of java >= ('0', '1.5', None) Installing : 2000:jdk1.8-1.8.0_301-fcs.x86_64 1/1 Unpacking JAR files... tools.jar... plugin.jar... javaws.jar... deploy.jar... rt.jar... jsse.jar... charsets.jar... localedata.jar... Verifying : 2000:jdk1.8-1.8.0_301-fcs.x86_64 1/1 Installed: jdk1.8.x86_64 2000:1.8.0_301-fcs Complete!
[root@localhost ~]# vim /etc/profile unset i unset -f pathmunge export JAVA_HOME=/usr/java/jdk1.8.0_301-amd64 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
[root@localhost ~]# source /etc/profile
[root@localhost ~]# env JAVA_HOME=/usr/java/jdk1.8.0_301-amd64 PATH=$JAVA_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
(特别说明:环境变量位置为随机分布)
暂无。
[root@localhost ~]# java -version java version "1.8.0_301" Java(TM) SE Runtime Environment (build 1.8.0_301-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
暂无。
[root@localhost ~]# rpm -qa | grep jdk jdk-11.0.12-11.0.12-ga.x86_64
[root@localhost ~]# rpm -e jdk-11.0.12-11.0.12-ga.x86_64 --nodeps
参数选项:
rpm -e jdk 普通删除模式
rpm -e --nodeps 强力删除模式,如果使用上面命令删除时,提示有依赖的其他文件,则 用该命令可以对其进行强力删除。
[root@localhost ~]# cd /usr/java/jdk1.8.0_301-amd64 [root@localhost jdk1.8.0_301-amd64]# ls bin include jmc.txt legal LICENSE README.html src.zip THIRDPARTYLICENSEREADME.txt COPYRIGHT javafx-src.zip jre lib man release THIRDPARTYLICENSEREADME-JAVAFX.txt