Wednesday, November 6, 2013

Install MariaDB in Ubuntu13.10

Ubuntu 13.10 is the latest release when I post this blog. I tried to install MariaDB following these instructions:


sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/repo/5.5/ubuntu saucy main'
sudo apt-get update
sudo apt-get install mariadb-server


(source: https://downloads.mariadb.org/mariadb/repositories/)


And I got this error message:

The following packages have unmet dependencies:
mariadb-server-5.5 : Depends: mariadb-client-5.5 (>= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
Depends: mariadb-server-core-5.5 (>= 5.5.33a+maria-1~saucy) 
but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


The reason for this issue is the version of MariaDB is mismatch with the version in the Ubuntu repositories (click to read more about this).


So, to fix that:


1. You have to specify the exact version of packages when installing MariaDB. In my case, they are:

sudo apt-get install mariadb-server-5.5="5.5.33a+maria-1~saucy" mariadb-client-5.5="5.5.33a+maria-1~saucy" libmysqlclient18="5.5.33a+maria-1~saucy" mysql-common="5.5.33a+maria-1~saucy"


2. After MariaDB is installed, and as long as the version number issue exists, an `apt-get dist-upgrade` will try to remove MariaDB in order to install the "upgraded" libmysqlclient and mysql-common packages. To prevent this from happening you can hold them so that apt doesn't try to upgrade them. To do so, open a terminal, become root with "sudo -s, and then enter the following:


echo libmysqlclient18 hold | dpkg --set-selections
echo mysql-common hold | dpkg --set-selections


The holds will prevent you from upgrading MariaDB, so when you want to remove the holds, open a terminal, become root with 'sudo -s', and then enter the following:


echo libmysqlclient18 install | dpkg --set-selections
echo mysql-common install | dpkg --set-selections


You will then be able to upgrade MariaDB as normal (e.g. with "sudo apt-get update; sudo apt-get upgrade").



References: http://askubuntu.com/questions/365992/ubuntu-13-10-installing-mariadb