[CentOS] do not uninstall old when yum install new

Tue Mar 26 15:54:58 UTC 2019
Johnny Hughes <johnny at centos.org>

On 3/25/19 9:31 PM, Kenneth Porter wrote:
> --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.
> 

Also note that unless packages are written to be install_only .. you
can't do that.

Kernel is specially designed to have more than one installed.  You can
not install 2 different versions of almost anything else from the base
repos .. ie, you can't install 2 pythons or 2 perls etc .. UNLESS you
use something like Software Collections:

https://wiki.centos.org/SpecialInterestGroup/SCLo

A normal package will provide something like /usr/bin/firefox  .. the
upgrade will replace it .. they both can not live normally installed at
the same time.

Other than SCLs, there is also an 'alternatives' system that can be used:

https://wiki.centos.org/HowTos/JavaRuntimeEnvironment

(that is one example how to use the 'alternatives' system)

Anyway .. you can't just tell yum to leave more than one version of an
installed package on your systems .. it requires lots of knowledge and a
plan with different locations and ways to point things at the correct
place, etc.  You will almost certainly need to redesign and rebuild your
own packages unless you can use something like SCLs.

Thanks,
Johnny Hughes


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20190326/4ae1187d/attachment-0006.sig>