Installing MariaDB on ubuntu or debian

Yesterday I was installing a server. I needed a stack to run drupal on top of Ubuntu. Lately I have been playing with NGINX, php-fpm and MariaDB. And since Oracle took over mysql, I wanted to use the more “opensource” version of it, being MariaDB.(By the way, is also using MariaDB)

But if you want to use apt-get, installing MariaDB requires some extra work compared to installing mysql. I used my good old friend google to look up the necessary information, and I had to puzzle the pieces together. Now that I have it all puzzled together, I want to document it here. I am going to use a lot of the .

First of all you need to import the gpg key mariadb uses to sign the repositories. The key enables apt to verify the integrity of the packages it downloads. The import can be done using the apt-key application.

 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db

Once the key is added you are ready to add the appropriate repository. 

Now use the to generate the necessary information based on OS (debian or ubuntu), version of the OS, version of mariadb and the location of the repository. Copy the output of the generator and do one of the following things:

  • Add the copied information to /etc/apt/sources.list
  • Make a new /etc/apt/sources.list.d/mariadb.list file and add the copied information

Once this is done, update your package list (and download the information apt needs to install MariaDB):

 sudo apt-get update

For those of you that want to secure their installation, please use this command:

 mysql_secure_installation

 

Leave a Reply

Your email address will not be published. Required fields are marked *