How to force Yum to install an older package which "is obsoleted by" a newer package?

9,569

I couldn't find a way to do this with Yum only. What I ended up doing was a two step process:

  1. Use rpm to remove the mysql-commercial-* packages, but don't remove any dependencies.

    [root@devdb ~]# rpm --erase --nodeps mysql-commercial-server mysql-commercial-libs-compat mysql-commercial-client mysql-commercial-common mysql-commercial-libs
    warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
    [root@devdb ~]#
    
  2. And then use Yum to install the mysql-community packages, at the closest version number I can find:

    [root@devdb ~]# yum --disablerepo=local-mysql-enterprise install mysql-community-libs-5.6.40-2.el6.el6.x86_64 mysql-community-common-5.6.40-2.el6.el6.x86_64 mysql-community-client-5.6.40-2.el6.el6.x86_64 mysql-community-libs-compat-5.6.40-2.el6.el6.x86_64 mysql-community-server-5.6.40-2.el6.el6.x86_64 
    ...
    Installed:
      mysql-community-client.x86_64 0:5.7.22-1.el6               mysql-community-common.x86_64 0:5.7.22-1.el6
        mysql-community-libs.x86_64 0:5.7.22-1.el6                 mysql-community-libs-compat.x86_64 0:5.7.22-1.el6
        mysql-community-server.x86_64 0:5.7.22-1.el6
    
    Complete!
    [root@devdb ~]#
    
  3. And restore some core files:

    [root@devdb ~]#cp /etc/my.cnf.rpmsave /etc/my.cnf
    [root@devdb ~]#
    
Share:
9,569
Stefan Lasiewski
Author by

Stefan Lasiewski

Stefan Lasiewski Daddy, Linux Guy, Bicyclist, Tinkerer, Fixer & Breaker of things. I work as a Senior SYstem Engineer at the National Energy Research Scientific Computing Center (NERSC) Division at Lawrence Berkeley National Laboratory (LBNL) in Berkeley, CA. Father of 3 cute children. Yes I'm a sysadmin and a parent. Heavy user of CentOS, RHEL & FreeBSD for production services at work. I also run Ubuntu at home, for the simplicity. I'm a fan of Apache HTTP Server, Nagios & Cacti. Original proposer of unix.stackexchange.com (Yes, this proposal predated askubuntu.com, and I wish they would have merged with the Unix proposal.).

Updated on September 18, 2022

Comments

  • Stefan Lasiewski
    Stefan Lasiewski over 1 year

    I have a CentOS 6 host running a MySQL server. I want to migrate this server away from the MySQL Enterprise Server packages to MySQL Community Server packages, with the following specifics:

    • The MySQL Enterprise RPMs are called mysql-commercial-something and are at version '5.7.22-1.1'. I store these in a custom repo.
    • The Community RPMs are called mysql-community-something, and the latest available version is '5.7.22-1', which is a single '.1' release behind the Commercial version. These are stored in a public repo (http://repo.mysql.com/ ).

    Since the Community RPM has version number which is slightly behind the Commercial version, I cannot simply swap out one package for another. Yum complains with the error "Package foo-1 is obsoleted by foo-1.1":

    [root@devdb ~]# yum list --quiet available 'mysql-*-server'
    Available Packages
    mysql-community-server.x86_64                   5.7.22-1.el6                    mysql57-community
    [root@devdb ~]# 
    [root@devdb ~]# yum install --quiet mysql-community-server
    Package mysql-community-server-5.7.22-1.el6.x86_64 is obsoleted by mysql-commercial-server-5.7.22-1.1.el6.x86_64 which is already installed
    [root@devdb ~]# 
    

    I've tried a couple things, such as specifying the specific version number presented in How to install an older version of php (5.2.17) in Linux?, but that doesn't work in this case:

    [root@devdb ~]# yum install --quiet mysql-community-server-5.7.22-1.el6.x86_64 
    Package mysql-community-server-5.7.22-1.el6.x86_64 is obsoleted by mysql-commercial-server-5.7.22-1.1.el6.x86_64 which is already installed
    [root@devdb ~]#
    

    How can I force Yum to use use a package with an older version number?