Install MariaDB on Ubuntu


By Chandrashekhar Fakirpure

Updated on Jan 27, 2024

In this tutorial, we'll explain how to install MariaDB on Ubuntu 22.04. 

MariaDB is an open-source relational database management system (RDBMS) that is a fork of the popular MySQL database. It was created by the original developers of MySQL in response to concerns about the acquisition of MySQL by Oracle Corporation.

Let's start with the installation process.

Install MariaDB on Ubuntu

1 - Update the server

First, we need to update the server. It will update the source list.

sudo apt-get update

2 - Install dependencies

sudo apt-get install apt-transport-https curl nano

3 - Import MariaDB repository key

Before we install MariaDB, first we need to install key. It will help us to identify that the installer we're using is authenticated.

sudo mkdir -p /etc/apt/keyrings
sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp ''

4 - Add repository

Once the key is imported, we need to add the repository. This step is important to install latest or any required version of MariaDB. The built in repository may install the older version of the MariaDB. First, create a file in /etc/apt/sources.list.d.

sudo nano /etc/apt/sources.list.d/mariadb.sources

Now, copy and paste the following lines in the file. Here we're installing 11.1 version of MariaDB.

# MariaDB 11.1 repository list
X-Repolib-Name: MariaDB
Types: deb
Suites: jammy
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp

5 - Install MariaDB 11.1

Finally, execute the following command to install MariaDB.

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

Verify the installation:

systemctl status mariadb

That's it, we seen how to install MariaDB on Ubuntu.