How to install MariaDB rpms in CentOS 6.4 using rpm (not yum cmd) + handling mysql-libs conflicts

ryuken asked:

I need to script the install of MariaDB using the rpm command in CentOS 6.4. I can’t use yum since it’s going to be an offline install so there’s no access to the repository.

The only MySQL package installed is mysql-libs as various other packages in CentOS depend on it. When I did a test install of MariaDB with yum it correctly accounted for mysql-libs and uninstalled it at the end as MariaDB could handle the dependencies after it was installed:

[root@new-host-6 ~]# yum install MariaDB-client MariaDB-common MariaDB-compat MariaDB-devel MariaDB-server MariaDB-shared
Loaded plugins: downloadonly, fastestmirror, refresh-packagekit, security, verify
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:5.5.32-1 will be installed
---> Package MariaDB-common.x86_64 0:5.5.32-1 will be installed
---> Package MariaDB-compat.x86_64 0:5.5.32-1 will be obsoleting
---> Package MariaDB-devel.x86_64 0:5.5.32-1 will be installed
---> Package MariaDB-server.x86_64 0:5.5.32-1 will be installed
---> Package MariaDB-shared.x86_64 0:5.5.32-1 will be obsoleting
---> Package mysql-libs.x86_64 0:5.1.66-2.el6_3 will be obsoleted
--> Finished Dependency Resolution

Dependencies Resolved

 Package                                     Arch                                Version                                 Repository                            Size
 MariaDB-client                              x86_64                              5.5.32-1                                mariadb                               10 M
 MariaDB-common                              x86_64                              5.5.32-1                                mariadb                               23 k
 MariaDB-compat                              x86_64                              5.5.32-1                                mariadb                              2.7 M
     replacing  mysql-libs.x86_64 5.1.66-2.el6_3
 MariaDB-devel                               x86_64                              5.5.32-1                                mariadb                              5.6 M
 MariaDB-server                              x86_64                              5.5.32-1                                mariadb                               34 M
 MariaDB-shared                              x86_64                              5.5.32-1                                mariadb                              1.1 M
     replacing  mysql-libs.x86_64 5.1.66-2.el6_3

Transaction Summary
Install       6 Package(s)

Total download size: 53 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): MariaDB-5.5.32-centos6-x86_64-client.rpm                                                                                              |  10 MB     00:06     
(2/6): MariaDB-5.5.32-centos6-x86_64-common.rpm                                                                                              |  23 kB     00:00     
(3/6): MariaDB-5.5.32-centos6-x86_64-compat.rpm                                                                                              | 2.7 MB     00:02     
(4/6): MariaDB-5.5.32-centos6-x86_64-devel.rpm                                                                                               | 5.6 MB     00:06     
(5/6): MariaDB-5.5.32-centos6-x86_64-server.rpm                                                                                              |  34 MB     00:23     
(6/6): MariaDB-5.5.32-centos6-x86_64-shared.rpm                                                                                              | 1.1 MB     00:00     
Total                                                                                                                               1.3 MB/s |  53 MB     00:40     
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
Retrieving key from
Importing GPG key 0x1BB943DB:
 Userid: "Daniel Bartholomew (Monty Program signing key) <>"
 From  :
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : MariaDB-compat-5.5.32-1.x86_64                                                                                                                   1/7 
  Installing : MariaDB-common-5.5.32-1.x86_64                                                                                                                   2/7 
  Installing : MariaDB-server-5.5.32-1.x86_64                                                                                                                   3/7 
chown: cannot access `/var/lib/mysql': No such file or directory

To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h new-host-6 password 'new-password'

Alternatively you can run:

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at or the
MySQL manual for more instructions.

Please report any problems with the '/usr/bin/mysqlbug' script!

The latest information about MariaDB is available at
You can find additional information about the MySQL part at:
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at
Alternatively consider joining our community based development effort:

  Installing : MariaDB-devel-5.5.32-1.x86_64                                                                                                                    4/7 
  Installing : MariaDB-client-5.5.32-1.x86_64                                                                                                                   5/7 
  Installing : MariaDB-shared-5.5.32-1.x86_64                                                                                                                   6/7 
  Erasing    : mysql-libs-5.1.66-2.el6_3.x86_64                                                                                                                 7/7 
  Verifying  : MariaDB-common-5.5.32-1.x86_64                                                                                                                   1/7 
  Verifying  : MariaDB-server-5.5.32-1.x86_64                                                                                                                   2/7 
  Verifying  : MariaDB-devel-5.5.32-1.x86_64                                                                                                                    3/7 
  Verifying  : MariaDB-client-5.5.32-1.x86_64                                                                                                                   4/7 
  Verifying  : MariaDB-compat-5.5.32-1.x86_64                                                                                                                   5/7 
  Verifying  : MariaDB-shared-5.5.32-1.x86_64                                                                                                                   6/7 
  Verifying  : mysql-libs-5.1.66-2.el6_3.x86_64                                                                                                                 7/7 

  MariaDB-client.x86_64 0:5.5.32-1         MariaDB-common.x86_64 0:5.5.32-1         MariaDB-compat.x86_64 0:5.5.32-1         MariaDB-devel.x86_64 0:5.5.32-1        
  MariaDB-server.x86_64 0:5.5.32-1         MariaDB-shared.x86_64 0:5.5.32-1        

  mysql-libs.x86_64 0:5.1.66-2.el6_3                                                                                                                                


My question is, what is the equivalent way to install the MariaDB packages using the rpm command only as opposed to yum?

If I do rpm -ivh MariaDB*.rpm, I will get a ton of messages like the following about conflicts with mysql-libs:

file /etc/my.cnf from install of MariaDB-common-5.5.32-1.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MariaDB-common-5.5.32-1.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64

I then used the –force option to install the MariaDB rpms and uninstalled mysql-lib, I didn’t get any weird messages but I’m not sure that is the cleanest method to handle the conflicts and do the install.

So can someone confirm that installing MariaDB with the following rpm commands would be the same as using yum to install the packages and handle mysql-libs conflicts/removal:

rpm -ivh –force MariaDB*.rpm

rpm -e mysql-libs

Thanks for any input!

My answer:

You don’t. You use yum so that it handles this situation cleanly. It operates perfectly well offline using RPM packages directly, provided that all the necessary dependencies are available or already installed.

  1. Download the appropriate MariaDB RPMs to your USB stick or DVD-ROM.

    yumdownloader MariaDB-client MariaDB-common MariaDB-compat MariaDB-devel MariaDB-server MariaDB-shared
  2. Take your USB stick or DVD-ROM to the target machine and copy them in.

  3. Install them:

    yum --disablerepo=* -y install MariaDB-*.rpm

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.