As we all know, MySQL 5.5 is the best thing since sliced bread (or, not exactly, but that’s what everyone will have you think), but unfortunately Ubuntu‘s latest and greatest server operating system – Ubuntu 10.10 Server comes with MySQL 5.1.
Even the next version of Ubuntu – 11.04 Natty Narwhal – doesn’t seem to deliver MySQL 5.5, so upgrading is not really an option as of yet. There is a bug report to deliver MySQL 5.5 for Natty, which is even marked as “in progress” but there’s no guarantee that it will happen.
So how to go about (ab)using the latest software from Oracle? One way is to build it yourself on your server, or convert the Oracle provided RPM packages using the alien tool – but its not really Ubuntu native and a mess (in both cases). Here is another approach:
We can instead install native Ubuntu packages for MySQL 5.5, based on the work in progress for the Ubuntu bug listed above, by using the source packages from Clint Byrum’s(1) PPA and building them locally on your Ubuntu 10.10 server.
It looks that this build nicely, passes all the tests and installs cleanly on an Ubuntu 10.10 server without any hassles, so here is a simple walk through:
- Setup the PPA repository: go over to Clint Byrum’s PPA (by clicking on this link) and click on “Technical details about this PPA”. In the select box, choose “Lucid” – because the PPA no longer has Maverick packages, but the Lucid ones should work as well. Now in the box below that copy just the “deb-src” line and add it to the end of the
/etc/apt/sources.listfile on your Ubuntu 10.10 server. Don’t get the first “deb” line because that will add the binary repository and this can mess up your system when you do an upgrade later.
- Get the source package: create a new directory somewhere where you want to build the package and open a terminal and change to it, then run from the command line the command
apt-get updateand then
apt-get source mysql-5.5.
- Install dependencies: in the sources that were downloaded into the directory you created in the above step, you’d find a directory called
mysql-5.5-some-version, change into it and run
dpkg-buildpackage. The command will run and then stop after complaining about missing dependencies. copy the names of all the dependencies (without the version information) and type
apt-get installfollowed by the names of all the missing packages. Complete the installation and configuration of all the required packages.
- Build the new Ubuntu package: run
dpkg-buildpackageagain and watch it complete the build and tests. The build is pretty quick – I was very impressed, but the tests take forever and a half – be patient and equip yourself with a hot beverage and something to pass the time. Finally it will report that the new
debpackages have been successfully built.
- Install the new software: go up one directory to the directory where you downloaded the source and install any package you need using the command
dpkg -ifollowed by the file names of each
debpackage you require. When installing the
mysql-server-corepackage you should get a configuration screen to set up the root password for the server, so don’t forget to set it to something that is useful.
- Last minute configuration: the mysql-5.5 packages built are designed for Natty (Ubuntu 11.04) and therefor have some Natty specific features. In order to get the MySQL server to start, we need to edit the file
/etc/init/mysqland in the
pre-startsection comment out the
apparmorline – this will not work in Ubuntu 10.10 and will cause the server to fail to load.
- Start the server: at this point we have only to start the server by issuing the “upstart” command
- What happened to MySQL? (coder2developer.wordpress.com)
- Getting started with MySQL on Ubuntu (curiousx.wordpress.com)
- Oracle Releases MySQL 5.5 (developers.slashdot.org)
- The guy who works on the 5.5 package for Natty [↩]