Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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: mirrors.kernel.org
 * extras: mirror.keystealth.org
 * updates: mirror.umd.edu
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
====================================================================================================================================================================
Installing:
 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 https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
Importing GPG key 0x1BB943DB:
 Userid: "Daniel Bartholomew (Monty Program signing key) <dbart@askmonty.org>"
 From  : https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
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

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
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:
'/usr/bin/mysql_secure_installation'

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 http://kb.askmonty.org 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 http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Support MariaDB development by buying support/new features from
Monty Program Ab. You can contact us about this at sales@montyprogram.com.
Alternatively consider joining our community based development effort:
http://kb.askmonty.org/en/contributing-to-the-mariadb-project/

  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 

Installed:
  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        

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

Complete!

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!

share|improve this question

2 Answers 2

I use following repo (as /etc/yum.repos.d/mariadb.repo):

# MariaDB 5.5 CentOS repository list - created 2013-09-14 02:06 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

For applications it's important to have binary compatibility, which is done by installing MariaDB-compat package available from same repo (for some reason, I don't see it in your list):

[root@backup ~]# rpm -qlp mysql-libs-5.1.69-1.el6_4.x86_64.rpm |grep so
/etc/ld.so.conf.d/mysql-x86_64.conf
/usr/lib64/mysql/libmysqlclient.so.16
/usr/lib64/mysql/libmysqlclient.so.16.0.0
/usr/lib64/mysql/libmysqlclient_r.so.16
/usr/lib64/mysql/libmysqlclient_r.so.16.0.0
[root@backup ~]# rpm -qlp MariaDB-5.5.32-centos6-x86_64-compat.rpm
/usr/lib64/libmysqlclient.so.15
/usr/lib64/libmysqlclient.so.15.0.0
/usr/lib64/libmysqlclient.so.16
/usr/lib64/libmysqlclient.so.16.0.0
/usr/lib64/libmysqlclient_r.so.15
/usr/lib64/libmysqlclient_r.so.15.0.0
/usr/lib64/libmysqlclient_r.so.16
/usr/lib64/libmysqlclient_r.so.16.0.0

So, you can uninstall mysql-libs and then install MariaDB-server package, which will install all the requirements and MariaDB-compat package too, which obsoletes mysql-libs, so dependenecies won't be broken:

[root@backup ~]# rpm -qp --obsoletes MariaDB-5.5.32-centos6-x86_64-compat.rpm 
mysql-libs < 5.3.5
[root@backup ~]# 

So, no problems after that, rpm won't report any incompatibilities, (provides mysql-libs = 5.3.5):

[root@backup ~]# rpm -qlp --provides MariaDB-5.5.32-centos6-x86_64-compat.rpm 
libmysqlclient.so.15()(64bit)  
libmysqlclient.so.15(libmysqlclient_15)(64bit)  
libmysqlclient.so.16()(64bit)  
libmysqlclient.so.16(libmysqlclient_16)(64bit)  
libmysqlclient_r.so.15()(64bit)  
libmysqlclient_r.so.15(libmysqlclient_15)(64bit)  
libmysqlclient_r.so.16()(64bit)  
libmysqlclient_r.so.16(libmysqlclient_16)(64bit)  
mysql-libs = 5.3.5
MariaDB-compat = 5.5.32-1
MariaDB-compat(x86-64) = 5.5.32-1
/usr/lib64/libmysqlclient.so.15
/usr/lib64/libmysqlclient.so.15.0.0
/usr/lib64/libmysqlclient.so.16
/usr/lib64/libmysqlclient.so.16.0.0
/usr/lib64/libmysqlclient_r.so.15
/usr/lib64/libmysqlclient_r.so.15.0.0
/usr/lib64/libmysqlclient_r.so.16
/usr/lib64/libmysqlclient_r.so.16.0.0
[root@backup ~]#

Answer: yes, you can just uninstall mysql-libs and install these packages, but downloaded from this repo.

(yumdownloader MariaDB-client.x86_64 MariaDB-common.x86_64 MariaDB-compat.x86_64 etc)

share|improve this answer
    
I don't understand how this helps with doing an offline installation? –  Michael Hampton Sep 14 '13 at 2:20
    
added to the end :) Guy knows how to download and put files to the server. –  GioMac Sep 14 '13 at 2:27

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
    
share|improve this answer
    
localinstall goes into the internets to check for dependencies. –  Danila Ladner Sep 14 '13 at 2:34
    
hahah, yum localinstall -y MariaDB-*.rpm –  GioMac Sep 14 '13 at 2:34
    
@GioMac On EL6 they can be used interchangeably. There was only a difference on EL5. –  Michael Hampton Sep 14 '13 at 2:36
    
unless you configure local repo on the box and enable only that repo. –  Danila Ladner Sep 14 '13 at 2:37
    
Yes, I see, actually never used it (I'm fine with rpm), still not satisfied with how yum works, RHEL5 yum is a headache. RHEL7 will be fine. –  GioMac Sep 14 '13 at 2:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.