43

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

Artur Meinild
  • 31,035
john
  • 533

9 Answers9

33

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.

Mateo
  • 8,152
Lucio
  • 19,191
  • 32
  • 112
  • 191
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.

Jorge Castro
  • 73,717
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.

robmuh
  • 121
  • 1
  • 2
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/

Seth
  • 59,332
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.

gone
  • 369
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.

Stefano
  • 2,394
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.

Artur Meinild
  • 31,035
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

JoKeR
  • 7,062
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