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.