43

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

3
  • Check this one i found on internet zobnetworks.com/tutorials/linux/… It looks kind of easy to do it. Enjoy
    – user270846
    Apr 19, 2014 at 8:49
  • Jorge, unless I typed something wrong, that other answer didn't work on Ubuntu 15.04, the answer below did. But I've been away from Unix for 25 years so it may have been my mistake. But I guess the QUESTION is the same, so if I'm correct that the answers are wrong, maybe it just needs the answer below added to it. May 14, 2015 at 22:49
  • Indeed, I'll flag to merge these so that we'll have all the versions in one place, thanks. May 15, 2015 at 10:21

9 Answers 9

33
+50

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.

2
26

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.

1
  • 1
    Do you have to enable universe repos or similar? On 14.04.1 LTS I'm getting "Unable to locate package mariadb-server" Sep 16, 2014 at 0:07
12

For 13.04 Raring Ringtail / 13.10 Saucy Salamander

Install the certificates/keys:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db  

Then add the repository to the end of your /etc/apt/sources.list with:

sudo add-apt-repository "deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu $(lsb_release -c -s) main"

And install the package:

sudo apt-get update
sudo apt-get install mariadb-server  

I have confirmed it on a local install.

4
  • I get: dpkg: error processing /var/cache/apt/archives/libmysqlclient18_5.5.32+maria-1~raring_amd64.deb (--unpack): libmysqlclient18:amd64 5.5.32+maria-1~raring (Multi-Arch: no) is not co-installable with libmysqlclient18 which has multiple installed instances Sep 9, 2013 at 7:56
  • Using Ubuntu 13.10, I skipped the certificates/keys steps and it worked like a charm. Dec 7, 2013 at 18:20
  • What aboout MariaDB 10?
    – rubo77
    Feb 18, 2014 at 7:34
  • Be aware, that this adds a second repository with the path main to your sources, which can lead to conflicts: askubuntu.com/questions/425516/…
    – rubo77
    Feb 25, 2014 at 10:53
4

For 12.10 Quantal Quetzal

Install the certificates/keys:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db  

Add the repository to the end of your /etc/apt/sources.list with:

sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu quantal main'  

And install the package:

sudo apt-get update
sudo apt-get install mariadb-server  

If you want you can create a custom MariaDB sources.list file. Copy and paste the following into a file named MariaDB.list under /etc/apt/sources.list.d/ (it can also be added it to the bottom of /etc/apt/sources.list):

# MariaDB 5.5 repository list - created 2013-02-01 01:36 UTC
# http://mariadb.org/mariadb/repositories/
deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu quantal main
deb-src http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu quantal main  

(Re)Sources:

https://kb.askmonty.org/en/installing-mariadb-deb-files/

https://downloads.mariadb.org/mariadb/repositories/

1
3

At this moment, MariaDB does not have Oneiric repository, but only Natty (11.04): http://downloads.askmonty.org/mariadb/repositories/

As Oneiric is still in beta, you should wait for the final release, or try using the Natty repository.

4
  • Do I need to uninstall mysql before putting mariadb?
    – john
    Oct 8, 2011 at 9:31
  • 2
    Why MariaDB is not included in normal ubuntu repositories? Does Phpmyadmin work with mariadb?
    – john
    Oct 8, 2011 at 9:31
  • 1
    I never done it, but I think you can have both MySQL and MariaDB on system, using different ports (es. 3306 and 3307). MariaDB is not included in normal repositories, because it is not so largely used like MySQL. For PHPMyAdmin, it should work because MariaDB says to be full compatibile with MySQL connectors: kb.askmonty.org/en/mariadb-versus-mysql
    – Stefano
    Oct 8, 2011 at 13:54
  • 1
    MariaDB is binary compatible with MySQL most things will not be able to tell the difference. Phpmyadmin will work, MySQLWorkbench works fine too on my system. When you ask for an InnoDB table you really get a XtraDB table, I have some queries that require a number of expensive inner selects... I have not found a query that performs slower on my tables and at least one important one takes only a third the time it used to.
    – Quaternion
    Dec 1, 2011 at 22:42
3

Ubuntu 14.04 LTS
If you have MySQL already setup, you should remove it.

These steps allow you to preserve your existing MySQL databases. Just follow the MariaDB installation screens carefully.

(Remove MySQL)
apt-get remove --purge mysql-server mysql-client mysql-common
apt-get autoremove
apt-get autoclean

*** The above steps also remove phpMyAdmin and MySQLI

(Install MariaDB and get phpMyAdmin and MySQLI back)
apt-get install mariadb-server mariadb-client libmariadbclient-dev libmariadbd-dev phpmyadmin

You might not require the dev packages. Reconfigure phpMyAdmin to use SSL only by editing /etc/phpmyadmin/apache.conf.

At this point, most things will be working, but I had problems with my Dovecot install. So I installed the following packages as well:

apt-get install dovecot-mysql       *fixed mail receipt but sending is still blocked.
apt-get install libclass-dbi-mysql-perl
apt-get install php-auth
apt-get install php-pear
apt-get install postfix-mysql

The last 3 apt-get commands might not be necessary (since the libclass-dbi-mysql-perl package might install them), but on my Test server I needed to do them separately.

Everything on my LAMP server is now running nicely. If you have other software installed, you might need to test it to ensure you aren't missing any libraries they need.

2

For Ubuntu 22.04 (Jammy Jellyfish)

There are 2 ways of installing MariaDB on Ubuntu 22.04 - from the Universe repo, or from the MariaDB repo.

1. Via Universe repo

Make sure the following lines are uncommented in /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu jammy universe
deb http://archive.ubuntu.com/ubuntu jammy-updates universe
deb http://archive.ubuntu.com/ubuntu jammy-security universe

Then run sudo apt install mariadb-server. Note that the Universe repo might be slower to implement security patches than the MariaDB repo - so some months may pass before an update hits this repo.

From the Universe repo, you can install MariaDB version 10.6.X only.

2. Via MariaDB official repo

Customize your repo configuration on this page.

With the following selected:

  • Distribution: 22.04 (Jammy)
  • MariaDB version: 10.6
  • Mirror: LiquidTelecom (Nairobi) (just an example - add the mirror closest to you)

Run the following to add the repo:

sudo apt-get install apt-transport-https curl
sudo curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc'
sudo sh -c "echo 'deb https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu jammy main' >>/etc/apt/sources.list"

Now you can run the following to install the latest version:

sudo apt update
sudo apt install mariadb-server

This version will likely be patched more often than the Universe provided version.

From the MariaDB repo, you can install any version from 10.6.X to 11.1.X (selectable when adding repo as of September 2023).

It should also be possible to add the MariaDB repo, and then run sudo apt upgrade to switch over to any newer version in the MariaDB repos.

NB: Please be aware that the MariaDB knowledge base article is not updated, and it wrongly states that only 18.04 and 20.04 are supported. Instead, use the repo configurator mentioned earlier.

1

To install MariaDB on your Ubuntu (Vivid) system open a terminal(Ctrl+Alt+T) and run:

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://tweedo.com/mirror/mariadb/repo/10.0/ubuntu vivid main'

Once the key is imported and the repository added you can install MariaDB with:

sudo apt-get update
sudo apt-get install mariadb-server

Complete guide on installing MariaDB .deb files manually can be found here

Mariadb Official Source

1

In case someone bumps on the question, MariaDB website have the "How to"

For 15.04 version 10.1 of MariaDB you just do:

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://mirror.zol.co.zw/mariadb/repo/10.1/ubuntu vivid main'

sudo apt-get update
sudo apt-get install mariadb-server

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .