Issue
I launched a new AWS EC2 instance (Amazon Linux AMI). I can install Java 1.8.0 on the machine like so:
sudo yum install java-1.8.0
I can also install using this command:
sudo yum install java-1.8.0-openjdk
The same packages and dependencies are installed in both cases. When I perform the following, I receive "No matching Packages to list":
yum info java-1.8.0
When I perform the following, "java-1.8.0" does not appear in the list, only "java-1.8.0-openjdk":
yum search java-1.8.0
My related questions are:
- Why does "sudo yum install java-1.8.0" work? Is it an alias on the yum repo?
- If this is indeed an alias, how would I know it exists? Is there a way to search for or list out aliases?
Solution
If "yum install" doesn't find a package with a specified name, it will look for packages providing a feature with that name. From the install section in the yum man page:
If the name doesn’t match a package, then package "provides" are searched (e.g. "_sqlite-cache.so()(64bit)") as are filelists (Eg. "/usr/bin/yum").
"java-1.8.0" is listed as a feature in the java-1.8.0-openjdk RPM, which is why that was installed by "yum install java-1.8.0-openjdk". If there were other packages providing that feature in yum, you could just as easily have gotten one of those instead. I'm not sure how yum chooses between multiple packages providing the same feature, but it's not something I would rely upon if the specific flavor/version of an application is important to you at all.
If you install yum-utils, the repoquery command can show you information about package features (among many other things). For example, repoquery --provides java-1.8.0-openjdk
would list all the features provided by that package. To search for all the packages providing the java-1.8.0 feature, you could either use repoquery --whatprovides java-1.8.0
or just yum provides java-1.8.0
. Note that in yum, "whatprovides" is the same as"provides"; both search for packages providing the specified feature. If you want to the features in a specified package, you need to use repoquery. (The rpm command would also work, if you've already installed or downloaded the package you want to query.)
Answered By - CantankerousGerbil Answer Checked By - Marilyn (WPSolving Volunteer)