November 24, 2014

Switching between versions using yum

YUM (Yellowdog Updater Modified) is a free package management software for Linux Yellowdog.One type of question we get very often (even in the form of filed bugs!) is how to switch from stock MySQL to Percona Server or switch from Percona Server 5.5 to Percona XtraDB Cluster using yum, but à la apt-get, i.e. having yum handle the replace.

In its simplest form, yum cannot replace a package¹ for another like apt-get does:

 

# yum -q -q install Percona-XtraDB-Cluster-server
Error: Percona-XtraDB-Cluster-server conflicts with Percona-Server-server-55
Error: Percona-XtraDB-Cluster-client conflicts with Percona-Server-client-55
Error: Percona-XtraDB-Cluster-shared conflicts with Percona-Server-shared-55

One solution for this is to manually uninstall Percona Server 5.5 and then install version 5.1, however you can run into issues if you’ve got installed software that depends on Percona Server — it will get uninstalled as well.

We can solve this by instructing yum to remove all 5.1 packages and install 5.5 in one transaction, using the yum shell.


# yum -q -q shell
> remove Percona-Server-client-55 Percona-Server-server-55 Percona-Server-shared-55
> install Percona-XtraDB-Cluster-server
> transaction run

Installing:
Percona-XtraDB-Cluster-server
Removing:
Percona-Server-client-55
Percona-Server-server-55
Percona-Server-shared-55
Installing for dependencies:
Percona-XtraDB-Cluster-client
Percona-XtraDB-Cluster-galera
Percona-XtraDB-Cluster-shared

Transaction Summary
Install 4 Package(s)
Update 0 Package(s)
Remove 3 Package(s)

This is also the easiest way for switching between Percona XtraBackup versions. For example, switching from 2.1 to our recently released 2.0 packages, without uninstalling XtraBackup:


# yum -q -q install percona-xtrabackup-20
Error: percona-xtrabackup-20 conflicts with percona-xtrabackup
# yum -q -q shell
> remove percona-xtrabackup
> install percona-xtrabackup-20
> transaction run

Note, however, that’s not possible to switch from 5.1 to 5.5, or from 5.5 to 5.6 directly, due to restrictions in the automated update process: the updater cancels the transaction and asks you to manually update the server package in order to safeguard the data. We’re working on the possibility of lifting this restriction.

This shouldn’t represent a problem for switching between versions without uninstalling dependencies though, since this restriction only applies to the Percona-Server-server-5x packages, and the dependencies are usually on the client or shared packages. Just execute the transaction installing the client and shared packages, and install the server package in another step.

¹ unless one of them Obsoletes: the other.

Speak Your Mind

*