How to install MariaDB?

What is the most stable/safest way to install MariaDB?


Solution 1:

For Precise Pangolin 12.04 LTS

  1. Install the repo manager

    sudo apt-get install python-software-properties
    
  2. Import the GnuPG signing key

    sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
    
  3. Modify your sources.list file to add MariadDB

    Open it from terminal (gksudo gedit /etc/apt/sources.list) and add the following lines at the end:

    • For Version 10:

      deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu precise main
      deb-src http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu precise main
      

      Or have the lines automatically added with:

      sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu precise main' 
      
    • For Version 5.5:

      deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main
      deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main
      

      Or have the lines automatically added with:

      sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main'
      
  4. Refresh your system

    sudo apt-get update

  5. And finally install MariaDB

    sudo apt-get install mariadb-server

For further information see the their download page.

Solution 2:

For 14.04 LTS and newer:

MariaDB 5.5 is included in 14.04, to install it you can do:

sudo apt-get install mariadb-server

An alternative would be to get it from MariaDB themselves by following these instructions.