Centos – the easiest way to get MySQL’s Archive Storage Engine working on CentOS 5.4

centosMySQLrpm

The Archive Storage Engine is not enabled by the default build of MySQL in CentOS/RHEL. I would like to enable it on our CentOS 5.4 server. My initial reaction was to modify the SPEC file for the SRPMS file, but this indicates that this might not be that easy. There's always the option to build from MySQL source, but I would prefer if possible to stay within the RPMS/Yum world.

Does anybody have a successful approach to this by using RPMS/SRPMS/Yum? Some patches which makes this work flawless with SRPMS?

Best Answer

I build MySQL with changes to the SPECS file for MySQL and the Archive storage engine got enabled. Here's a detailed step on how to get this up and running:

Install yum-utils:

sudo yum install yum-utils

Include RedHat's SRPMS to the CentOS repos:

sudo vi /etc/yum.repos.d/srpm.repo

Add the following repo configuration:

[rhel-src]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

I could not use $releasever in the URL, but had to set to 5Server.

Download the SRPMS package:

 yumdownloader --source mysql-server

Set up build area for a non-root user:

 yum install rpm-build redhat-rpm-config
 mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
 echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
 rpm -i mysql-server-5.0.xx.src.rpm

Install the required development tools:

 yum install gcc-c++ libtool gperf automake ncurses-devel readline-devel openssl-devel zlib-devel

To find all the required libraries and tools, just try to the following command:

 cd ~/rpmbuild/SPECS/

Modify the spec file:

 vi ~/rpmbuild/SPECS/mysql.spec

I added the following in the spec file (I wanted also to include the federated storage engine):

 %configure \
    ...
    --with-archive-storage-engine \
    --with-federated-storage-engine \
    ...

Be aware: This might have changed in MySQL 5.1 where plugin is used to specify storage engines.

In order to speed up the build process you should consider making this change:

 %{!?runselftest:%define runselftest 0}

Then run (as non-root user):

 cd ~/rpmbuild/SPECS/
 rpmbuild -ba mysql.spec

You'll find the RPMs in ~/rpmbuild/RPMS/i386. Just install and run MySQL and you will get a MySQL version with archive storage engine enabled.

Related Topic