[CentOS] do not uninstall old when yum install new

Tue Mar 26 02:31:41 UTC 2019
Kenneth Porter <shiva at sewingwitch.com>

--On Tuesday, March 26, 2019 10:07 AM +0800 wuzhouhui 
<wuzhouhui14 at mails.ucas.ac.cn> wrote:

> I have a specific needs that requires yum do not to uninstall old
> version when install new one. For example, I found that
>     yum install kernel
> will install new kernel, and old kernel will remained. But
>     yum install <something-else>
> will uninstall old version after install new one, how to disable it?

>From yum.conf(5):

installonlypkgs List of package provides that should only ever be 
installed, never updated.  Kernels in particular fall into this category. 
Defaults to kernel, kernel-bigmem, kernel-enter- prise, kernel-smp, 
kernel-debug, kernel-unsupported, kernel- source, kernel-devel, kernel-PAE, 
kernel-PAE-debug.

Note that because these are provides, and not just package names, 
kernel-devel will also apply to kernel-debug-devel, etc.

Note that "kernel-modules" is not in this list, in RHEL-6, and so anything 
providing that is updated like any other package.

installonly_limit Number of packages listed in installonlypkgs to keep 
installed at the same time. Setting to 0 disables this feature. Default is 
'3'. Note that this functionality used to be in the "installonlyn" plugin, 
where this option was altered via tokeep.  Note that as of version 3.2.24, 
yum will now look in the yumdb for a installonly attribute on installed 
packages. If that attribute is "keep", then they will never be removed.