Setting Up MariaDB v10.6.8 on CentOS 8 Stream

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

MariaDB is a free, open-source and one of the most popular relational database management system (RDBMS) which used in the web hosting industry. MariaDB is fork of the MySQL databaser server since the Oracle’s acquisition over MySQL AB in 2009. So, in other word, MariaDB is using the same source-code as MySQL and it become drop-in-replacement for MySQL since it initial release in 2010.

Currently MariaDB v10.6.8 is a long-term support stable version (LTS) which actively supported until July 2026. So, this release branch will still be actively maintenanced by MariaDB Team and have security patches until 5 years since the initial stable release in July 2021. MariaDB 10.6 can be installed in major Linux-based operating system, either it Debian-based like Ubuntu, RHEL-based OS like CentOS, CloudLinux, Oracle Linux, Amazon Linux, AlmaLinux and Rocky Linux.

In today’s tutorial we will show you on how to install or setting up MariaDB v10.6.8 database server on CentOS 8 Stream. It usefull for CLI-based web developer which familiar with command-line interface in Linux distribution system. So, if you’re unfamiliar with Linux CLI, don’t touch this or kindly using GUI-based environment. Make sure to meet the following pre-requisites before installing MariaDB 10.6.8 on CentOS 8 machine.

PRE-REQUISITES:

* VPS, Cloud or Bare-Metal Servers
* OS Flavours CentOS Stream 8
* Superuser Privileges (Root Access)
* Familiar with CLI-Based or Command-Line Only
* Gnome Terminal for Linux Desktop
* PuTTy SSH Client for Windows or Mac
* Powershell for Windows 10/11
* Familiar with DNF-Based Commands

1.) Login to Server via SSH Terminal

$ ssh [email protected] -p22
[email protected]'s password:
Activate the web console with: systemctl enable --now cockpit.socket

2.) Create MariaDB YUM Repository

Let’s create a file called MariaDB YUM Repository “MariaDB.repo” for CentOS Stream 8. Then paste the following repository to a file MariaDB.repo and put it under /etc/yum.repos.d/ directory.

$ nano /etc/yum.repos.d/MariaDB.repo
----------------------------------------------------------------------------

# MariaDB 10.6 CentOS repository list - created 2022-06-01 02:51 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
baseurl = https://download.nus.edu.sg/mirror/mariadb/yum/10.6/centos8-amd64
module_hotfixes=1
gpgkey=https://download.nus.edu.sg/mirror/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1
----------------------------------------------------------------------------

PLEASE NOTE:

* This repository only for CentOS 8 with x86_64 architecture.
* MariaDB Server version 10.6.
* Mirror Download using National University of Singapore.

3.) Install MariaDB 10.6

After that simply run the following command to install MariaDB v10.6 database server on CentOS 8 machine.

$ dnf install MariaDB-server
MariaDB 101 kB/s | 586 kB 00:05
DigitalOcean Agent 75 kB/s | 3.3 kB 00:00
DigitalOcean Droplet Agent 48 kB/s | 3.3 kB 00:00
Dependencies resolved.
=====================================================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================================================
Installing:
MariaDB-server x86_64 10.6.8-1.el8 mariadb 25 M
Installing dependencies:
MariaDB-client x86_64 10.6.8-1.el8 mariadb 14 M
MariaDB-common x86_64 10.6.8-1.el8 mariadb 88 k
MariaDB-shared x86_64 10.6.8-1.el8 mariadb 116 k
boost-program-options x86_64 1.66.0-10.el8 appstream 141 k
galera-4 x86_64 26.4.11-1.el8 mariadb 13 M
libaio x86_64 0.3.112-1.el8 baseos 33 k
libpmem x86_64 1.6.1-1.el8 appstream 79 k
lsof x86_64 4.93.2-1.el8 baseos 253 k
perl-DBI x86_64 1.641-3.module_el8.3.0+413+9be2aeb5 appstream 740 k
socat x86_64 1.7.4.1-1.el8 appstream 323 k
Enabling module streams:
perl-DBI 1.641

Transaction Summary
=====================================================================================================================================================
Install 11 Packages

Total download size: 55 M
Installed size: 213 M
Is this ok [y/N]: y

4.) Command to Manage MariaDB 10.6

To manage MariaDB v10.6 database server on CentOS Stream 8 you can use one of the following commands on SSH terminal.

READ:  How To Install MariaDB 10.6 on Alibaba ECS Running Debian 11 (bullseye)

To Start MariaDB

$ systemctl start mariadb

To Stop MariaDB

$ systemctl stop mariadb

To Restart MariaDB

$ systemctl restart mariadb

To Check MariaDB Service State

$ systemctl status mariadb
● mariadb.service - MariaDB 10.6.8 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Wed 2022-06-01 03:00:52 UTC; 7s ago
Docs: man:mariadbd(8)
https://mariadb.com/kb/en/library/systemd/
Process: 20779 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 20758 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]>
Process: 20756 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 20768 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 11 (limit: 4744)
Memory: 69.4M
CGroup: /system.slice/mariadb.service
└─20768 /usr/sbin/mariadbd

Enable MariaDB to Start Automatically from Boot

$ systemctl enable mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

5.) Verify MariaDB Version

You can execute using below command to check and verify MariaDB version. As you can see below that you’ve install the latest stable version of MariaDB v10.6.8 database server.

$ mysql -V
mysql Ver 15.1 Distrib 10.6.8-MariaDB, for Linux (x86_64) using readline 5.1

6.) Secure MariaDB Installation

In order to secure and harden the MariaDB Installation on production environment, don’t forget to securing your MariaDB 10.6 using the following command. During the securing installation proccess you will prompt to change the root account password for MySQL/MariaDB. Simply press “Y” to setup proper MariaDB root password if you previously don’t set a MariaDB root password.

$ mariadb-secure-installation
***mysql_secure_installation
PLEASE NOTE: Starting from MariaDB 10.4.6, mariadb-secure-installation is a symlink to mysql_secure_installation.
Starting from MariaDB 10.5.2, mysql_secure_installation is the symlink, and mariadb-secure-installation the binary name.
mariadb-secure-installation command
mariadb-secure-installation command

CONCLUSION:

In this step you’ve successfully in setting up the MariaDB 10.6.8 in CentOS 8 Stream machine. Then you can use this RDBMS to manage and hosted all of your website, blog or web-based applications.

Leave a Comment