1

I am new to unix systems, so forgive me if I am not being clear or saying something that makes no sense.

I just created an Amazon Linux AMI machine and I saw it comes with Java 7 (1.7.0_131) but I want Java 8, so I found this thread here showing how to update your java version....and it got me very confused on how yum works.

When I do a sudo yum search all java-1.8.0 I get this list as an output:

Loaded plugins: priorities, update-motd, upgrade-helper
================================ Matched: java-1.8.0 ================================
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK API Documentation compressed in
                                      : single archive
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle

The thread said to just type sudo yum install java-1.8.0 but There is no pure java-1.8.0 option on the list. So I guess there is a package named java-1.8.0 somewhere and the contents of this package might include some of these plugins returned by the YUM search.

So how can I see what a package name will actually install? Or how can I search for package names instead?

I want this kind of control so I can be able to find the packages like java-1.8.0 and not java-1.8.0-openjdk-headless.x86_64 and be able to understand what's inside java-1.8.0 compared to java-1.8.0-openjdk-headless.x86_64.

Also, I don't want to depend on google every time I want to install something, so I can find some tutorial showing me the package name and options, like:

sudo yum install tomcat6 tomcat6-webapps

Where can I find the tomcat6 by myself? How would I know there was an option named tomcat6-webapps?

2

To answer your question I'll show you what I'd do in order to install/upgrade java.

To see the current version of java installed I'd run:

java -version

To see the name of the java package which is currently installed, I'd run:

yum list installed | grep java

to install an openjdk java you'll have to run:

yum install java-1.8.0-openjdk.x86_64

As far as I know it is not possible to install java-1.8.0 just by running:

yum install java-1.8.0

as there are two versions of Java, one is the openjdk-java and the other is oracle-java.

So by supplying the -openjdk.x86.64 you actually tell yum which version of Java should be installed.

So the answer to your question "So how can I see what a package name will actually install? Or how can I search for package names instead?" is that you need to provide the exact name of the package you intend to install and that's the package which will be installed (along with it's dependancies).

In order to display files which a yum package contains, you can run the following command:

repoquery -l packagename

Example:

[root@centolel ~]# repoquery -l java-1.8.0-openjdk
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b13.el6.x86_64/jre/bin/policytool
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b13.el6.x86_64/jre/lib/amd64/libawt_xawt.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b13.el6.x86_64/jre/lib/amd64/libjawt.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b13.el6.x86_64/jre/lib/amd64/libjsoundalsa.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b13.el6.x86_64/jre/lib/amd64/libsplashscreen.so
/usr/share/applications/java-1.8.0-openjdk-1.8.0.121-1.b13.el6.x86_64-policytool.desktop
/usr/share/icons/hicolor/16x16/apps/java-1.8.0.png
/usr/share/icons/hicolor/24x24/apps/java-1.8.0.png
/usr/share/icons/hicolor/32x32/apps/java-1.8.0.png
/usr/share/icons/hicolor/48x48/apps/java-1.8.0.png

How can you find the tomcat6 packages?

[root@centolel ~]# yum search tomcat6
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.joinweb.co.il
 * epel: mirror.nonstop.co.il
 * extras: centos.joinweb.co.il
 * rpmforge: mirror1.hs-esslingen.de
 * updates: centos.joinweb.co.il
=========================================================================================== N/S Matched: tomcat6 ===========================================================================================
glite-security-trustmanager-tomcat6.noarch : Java trustmanager interface supporting a GSI grid name space
tomcat6.noarch : Apache Servlet/JSP Engine, RI for Servlet 2.5/JSP 2.1 API
tomcat6-admin-webapps.noarch : The host-manager and manager web applications for Apache Tomcat
tomcat6-docs-webapp.noarch : The docs web application for Apache Tomcat
tomcat6-el-2.1-api.noarch : Expression Language v1.0 API
tomcat6-javadoc.noarch : Javadoc generated documentation for Apache Tomcat
tomcat6-jsp-2.1-api.noarch : Apache Tomcat JSP API implementation classes
tomcat6-lib.noarch : Libraries needed to run the Tomcat Web container
tomcat6-servlet-2.5-api.noarch : Apache Tomcat Servlet API implementation classes
tomcat6-webapps.noarch : The ROOT and examples web applications for Apache Tomcat

Edit #1:

Okay, as I've tested it now it seems like I was wrong when I said you can't install using the yum install java-1.8.0, it works in my machine.

When I ran yum install java-1.8.0 on my test machine, it automatically suggested me the openjdk version so I guess it's the default one:

--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                                 Arch               Version                           Repository           Size
========================================================================================================================
Installing:
 java-1.8.0-openjdk                      x86_64             1:1.8.0.121-1.b13.el6             base                200 k
Installing for dependencies:
 java-1.8.0-openjdk-headless             x86_64             1:1.8.0.121-1.b13.el6             base                 32 M
 ttmkfdir                                x86_64             3.0.9-32.1.el6                    base                 43 k
 xorg-x11-fonts-Type1                    noarch             7.2-11.el6                        base                520 k

Another useful command is:

yum info java-1.8.0-openjdk.x86_64

I believe the answer you're looking for can be found here.

  • That's funny because I did the SAME as you did when I was looking for stuff to install...and that's what made me so confused! Look at here: serverfault.com/questions/664643/… they say to run sudo yum install java-1.8.0 sudo yum remove java-1.7.0-openjdk and there are 2 different answers with this same commands! So apparently there is something called java-1.8.0 I just have no idea where it is, where to find it, or what it fully does. – mFeinstein Apr 9 '17 at 17:07
  • Also, there is this link here for Tomcat: coenraets.org/blog/2011/11/… where he says to run sudo yum install tomcat6 tomcat6-webapps This one I REALLY what to undestand where tomcat6 comes from, because I want to install Tomcat 8.5 instead, and if the commands are different I have to know. Thanks for the answer and Pessach Kasher ve Sameach :) – mFeinstein Apr 9 '17 at 17:08
  • Oh, and btw I think repoquery is a command from yum-util not native to yum. – mFeinstein Apr 9 '17 at 17:09
  • Edited my answer. – Itai Ganot Apr 9 '17 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.