Thursday, July 17, 2014

[Level 1] How to yum to install specific version in CentOS.

If you want to use yum to install specific version in CentOS. First, you have to use option "--showduplicates" to get duplicate versions
# yum --showduplicates list java-1.7.0-openjdk
Loaded plugins: fastestmirror, refresh-packagekit, security, versionlock
Loading mirror speeds from cached hostfile
 * base: mirror01.idc.hinet.net
 * elrepo: ftp.ne.jp
 * epel: ftp.cuhk.edu.hk
 * extras: mirror01.idc.hinet.net
 * remi: remi.kazukioishi.net
 * rpmforge: ftp.riken.jp
 * updates: mirror01.idc.hinet.net
Available Packages
java-1.7.0-openjdk.x86_64           1:1.7.0.45-2.4.3.3.el6              base   
java-1.7.0-openjdk.x86_64           1:1.7.0.45-2.4.3.4.el6_5            updates
java-1.7.0-openjdk.x86_64           1:1.7.0.51-2.4.4.1.el6_5            updates
java-1.7.0-openjdk.x86_64           1:1.7.0.55-2.4.7.1.el6_5            updates
java-1.7.0-openjdk.x86_64           1:1.7.0.65-2.5.1.2.el6_5            updates
After you got the information of versions, then you could install option of yum to install specific version.
# yum install java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
Loaded plugins: fastestmirror, refresh-packagekit, security, versionlock
Loading mirror speeds from cached hostfile
 * base: mirror01.idc.hinet.net
 * elrepo: ftp.ne.jp
 * epel: ftp.cuhk.edu.hk
 * extras: mirror01.idc.hinet.net
 * remi: remi.kazukioishi.net
 * rpmforge: ftp.riken.jp
 * updates: mirror01.idc.hinet.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.7.0-openjdk.x86_64 1:1.7.0.45-2.4.3.3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                              Arch                     Version                                   Repository              Size
======================================================================================================================================
Installing:
 java-1.7.0-openjdk                   x86_64                   1:1.7.0.45-2.4.3.3.el6                    base                    26 M

Transaction Summary
======================================================================================================================================
Install       1 Package(s)

Total download size: 26 M
Installed size: 90 M
Is this ok [y/N]: y
...

Wish this helps.

regards,
Stanley Huang