一般情况下,centos会自带OpenJDK,Hadoop的运行环境要求自己配置JRE,但在home下配置好了JRE后,使用java -version仍然看到OpenJDK,原因是系统根据$PATH路径,首先会在/usr/bin/中找到OpenJDK的java,并非我们自己配置的JDK。
解决办法有两种:1.配置/etc/profile使/home/xxx/jdk/bin首先被找到。2.卸载OpenJDK
这里推荐第二种
1.查看安装了哪些OpenJDK
sudo rpm -qa | grep jdk
2.卸载OpenJDK
sudo yum -y remove java-1.8.0-open*
3.这时在/usr/bin中已经没有java了
4.使用java -version看到了自己配置的JDK,这里已经成功卸载
[hadoop@master1 ~]$ java -version java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
5.这一步可以不看了,仅仅是通过卸载记录来研究OpenJDK的RPM包依赖关系
[oracle@hadoop ~]$ yum -y remove java-1.8.0-openjdk* Loaded plugins: fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast You need to be root to perform this command. [oracle@hadoop ~]$ su Password: [root@hadoop oracle]# yum -y remove java-1.8.0-openjdk* Loaded plugins: fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Resolving Dependencies --> Running transaction check ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-2.b15.el7_3 will be erased --> Processing Dependency: java-headless >= 1:1.6 for package: 1:libreoffice-core-5.0.6.2-3.el7.x86_64 ---> Package unoconv.noarch 0:0.6-7.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Removing: java-1.8.0-openjdk-headless x86_64 1:1.8.0.111-2.b15.el7_3 @updates 102 M Removing for dependencies: libreoffice-calc x86_64 1:5.0.6.2-3.el7 @base 29 M unoconv noarch 0.6-7.el7 @base 196 k Transaction Summary ================================================================================ Remove 1 Package (+10 Dependent packages) Installed size: 402 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing : unoconv-0.6-7.el7.noarch 1/11 Erasing : 1:java-1.8.0-openjdk-headless-1.8.0.111-2.b15.el7_3.x86_ 11/11 failed to read link /usr/bin/java: No such file or directory Verifying : 1:libreoffice-writer-5.0.6.2-3.el7.x86_64 1/11 Verifying : 1:libreoffice-impress-5.0.6.2-3.el7.x86_64 2/11 Verifying : 1:libreoffice-pdfimport-5.0.6.2-3.el7.x86_64 3/11 Removed: java-1.8.0-openjdk-headless.x86_64 1:1.8.0.111-2.b15.el7_3 Dependency Removed: libreoffice-calc.x86_64 1:5.0.6.2-3.el7 unoconv.noarch 0:0.6-7.el7 Complete! [root@hadoop oracle]#
通过记录可以看出 libreoffice这个软件是基于JAVA的,卸载OpenJDK后,libreoffice就不能用了,节省了402M的磁盘空间。