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
?
Best Answer
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:
To see the name of the java package which is currently installed, I'd run:
to install an openjdk java you'll have to run:
As far as I know it is not possible to install java-1.8.0 just by running:
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:
Example:
How can you find the tomcat6 packages?
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:Another useful command is:
I believe the answer you're looking for can be found here.