Some background: I've deployed a central syslog-ng server at work, and I'm looking to use the nifty frontend, Logzilla (formerly known as php-syslog-ng). Unfortunately, Logzilla now requires MySQL 5.1, which isn't provided by RHEL/CentOS 5. This means I have to go rogue and run a non-standard MySQL build.
There are several ways to approach this problem (install from source, install the upstream RPMs), but from my perspective the "rightest" way is to track the current Fedora MySQL RPM and rebuild it for RHEL. This provides a proper RHEL-style name and dependency tree, and it packages all the fixes that Red Hat is going to put into their version.
So, here's how to do it.
Building MySQL 5.1
1) Ensure you can build RPMs as a normal user, since building as root is bad mmk. Dag explains how to go about this.
2) Download the latest SRPM from the latest Fedora source repo. As of the time of this writing, that means mysql-5.1.45-2.fc13.src.rpm from Fedora 13.
3) Grab the build requirements. This is going to heavily depend on what you've already got installed, but I needed to do:
yum install rpm-build autoconf automake gperf imake libtermcap-devel libtool ncurses-devel readline-devel
4) Install the RPM (note - the md5 signature signature mechanism seems to have changed, you must use the --nomd5 flag here, and you cannot directly rpmbuild the f13 srpm):
rpm --nomd5 -ivh mysql-5.1.45-2.fc13.src.rpm
5) Build the RPMs:
rpmbuild -ba [yourhomedir]/redhat/SPECS/mysql.spec
Hopefully, it'll build successfully. The RPMs will be in your [yourhomedir]/redhat/RPMS/ directory. But there's one little problem...
What about libmysqlclient.so.15?
If you tried to yum up to the RPM you just built, depending on what you've got installed you might get some nasty errors about a missing libmysqlclient.so.15. Looks like that library version has been deprecated in 5.1, oh noes!
You've got a couple of options here. You could just copy that library from your old install and do some ugly --force hacky stuff to install the new RPMs. It'll work, but it's nasty. You could also rip out those RPMs that require that library and rebuild *them*, but that's time consuming and means you've got even more stuff that's diverging from upstream. Of course, if you don't actually *use* any of those packages, you could ditch them entirely.
The approach I took was to build a shim RPM that provides *just* this library. I can't take credit for the idea, it turns out somebody had already come before me.
1) Download the spec file for this library from Remi Collet, the original creator.
2) Patch it for RHEL using my patch file, or just download my spec file directly.
3) Get the CentOS or RHEL mysql source rpm from the current repository (which is at the time of this writing CentOS 5.5).
4) Install the srpm (no need to --nomd5 this time!)
rpm -ivh mysql-5.0.77-4.el5_5.3.src.rpm
5) Build the new RPM:
rpmbuild -ba mysqlclient15-remi.spec
This should spit out a sweet new RPM.
Yum it up
Now you just have to install:
yum --nogpg install mysqlclient15-5.0.77-1.x86_64.rpm mysql-libs-5.1.48-2.x86_64.rpm mysql-5.1.48-2.x86_64.rpm mysql-devel-5.1.48-2.x86_64.rpm mysql-server-5.1.48-2.x86_64.rpm
And, voila! MySQL 5.1 with no dependency issues! You could even write a little shell script to pull updates and build the RPMs automatically.
(Side note - be sure to back up your database before upgrading! My upgrade went smoothly, but that's no guarantee that yours will!)