MySQL 5.5 on Ubuntu 10.10

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:

  1. 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.list file 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.
  2. 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 update and then apt-get source mysql-5.5.
  3. 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 install followed by the names of all the missing packages. Complete the installation and configuration of all the required packages.
  4. Build the new Ubuntu package: run dpkg-buildpackage again 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 deb packages have been successfully built.
  5. 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 -i followed by the file names of each deb package you require. When installing the mysql-server-core package 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.
  6. 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/mysql and in the pre-start section comment out the apparmor line – this will not work in Ubuntu 10.10 and will cause the server to fail to load.
  7. Start the server: at this point we have only to start the server by issuing the “upstart” command start mysql.
Enhanced by Zemanta

  1. The guy who works on the 5.5 package for Natty []

21 Responses to “MySQL 5.5 on Ubuntu 10.10”

  1. Athalas:

    When I do apt-get source mysql-5.5 at the end of step 2, all I receive is:
    E: Unable to find a source package for mysql-5.5

    Please advice.

  2. bull:

    Thank you very much for the pointing out the problem with the apparmor line.

  3. razor:

    note you’ll be putting the “natty main” source into your sources.list file, not “maverick main”

    and you might have to do apt-get install build-essential prior to running the apt-get source mysql-5.5

    These were the missing dependencies to the build that I found missing
    sudo apt-get install libtool
    sudo apt-get install debhelper
    sudo apt-get install libncurses5-dev
    sudo apt-get install libwrap0-dev
    sudo apt-get install zlib1g-dev
    sudo apt-get install libreadline-dev
    sudo apt-get install po-debconf
    sudo apt-get install chrpath
    sudo apt-get install doxygen
    sudo apt-get install texlive-latex-base
    sudo apt-get install ghostscript
    sudo apt-get install gawk
    sudo apt-get install bison
    sudo apt-get install hardening-wrapper
    sudo apt-get install cmake

    • Craig Crawford:

      That could be changed into one like like so:
      sudo apt-get install libtool debhelper libncurses5-dev libwrap0-dev zlib1g-dev libreadline-dev po-debconf chrpath doxygen texlive-latex-base ghostscript gawk bison hardening-wrapper cmake

  4. Mark:

    Same problem as Athalas here. Shame as I hate installing stuff behind apt’s back.

  5. Oded:

    You guys need to is in Step 1, choose “Maverick” in the “Choose your Ubuntu version” pull down in the list. I forgot to put that in, because if you access the PPA from your Ubuntu 10.10 desktop, it chooses it automatically. I’ll add it to the instructions.

  6. Chris:

    It appears that the URL for the PPA has changed slightly – this should be the correct path now:

    https://launchpad.net/~clint-fewbar/+archive/mysql

  7. Kilian:

    Seems like there is nomore “Maverick” in the dropdown…

    • Oded:

      Thanks for noting this.

      That is indeed a problem – it looks like the new PPA specifically does not deliver packages for maverick, though I’m not sure why: there are packages for Natty and for the older Lucid, but not for Maverick.

      I’ve updated the post to instruct people to select Lucid, which I think should work, but I have not tested this procedure for a while and I’m currently lacking resources to do so. So if you guys have any comments on improving the process – I’ll do so with pleasure.

      • Kilian:

        Hey i’m trying it now…but it keeps asking for a package called doxygen-latex (even if i have doxygen installed)…how to get around it? seems to be something from natty…

        • Oded:

          It indeed is something new from Natty. You should remove this requirement from debian meta-data files so it does not require it in the build. Otherwise you can build it also from source for 10.10.

          • Kilian:

            I had one unit test failing and therefor couldn’t build the package…damn :-S

          • Kmac:

            Ditto, the main.file_contents fails for me, so the build wont work.

          • Kilian:

            I got a link with .deb packages for mysql 5.5.8…have installed them on Ubuntu 10.10 maverick. Works like charme…except the libmysql which i couldn’t handle to get installed.
            Anyways libmysql 5.1 works with 5.5…so i’m happy for now.

            http://people.debian.org/~nobse/mysql-5.5/

          • Oded:

            Thanks for submitting the URL here. I hope it helps more people :-)

          • Ivo:

            The tests can be dissabled in the CMakeLists.txt file, there’s a line:

            OPTION (WITH_UNIT_TESTS “Compile MySQL with unit tests” ON)

            change it to

            OPTION (WITH_UNIT_TESTS “Compile MySQL with unit tests” OFF)

            Needless to say, do it on your own risk.

  8. כך חולפת תהילת עולם :: Things n' Stuff:

    [...] – חבל: לקצת זמן היה נראה שלי שהבלוג שלי אינו זוטה MySQL 5.5 on Ubuntu 10.10 [↩]VirtualBox on Ubuntu 11.04 [...]

  9. Installing MySQL 5.5 on Ubuntu 11.04 (Natty) « ss | blog:

    [...] from blog post/comments here. [...]

  10. Henry:

    This worked for me nicely..thanks

  11. Install MySQL 5.5 On Ubuntu 10.04 | Click & Find Answer !:

    [...] I have written an article on how to install MySQL 5.5 on Ubuntu 10.10 using Ubuntu packages, I’m pretty sure it will work without any major issues on 10.04: http://geek.co.il/wp/2011/03/02/mysql-5-5-on-ubuntu-10-10 [...]

Leave a Reply