How to Install MariaDB 10.6 on AlmaLinux 9

ComputingPost
7 min readJan 1, 2023

--

Oracle’s acquisition of MySQL in 2010 led to fears that the popular open-source database would become a paid service. In response, the original creators of MySQL developed MariaDB, and MariaDB is now one of the most popular open-source databases. Like MySQL, it is free and can be used for various purposes, including web development, data analysis, and application development. The developers behind MariaDB have promised to keep it open source and free from the same fears that led to its creation. This commitment has helped to solidify MariaDB’s position as a leading open-source database.

MariaDB 10.6 brings several significant improvements to the popular open source database, including improved performance, scalability, and new features such as a crash-safe replication mechanism and improved SQL compatibility. In terms of performance, MariaDB 10.6 includes several optimizations that can help to speed up database operations. For example, the new version contains several changes that can help to reduce disk IO and improve caching. These changes can result in a significant performance boost for high-traffic databases. MariaDB 10.6 also introduces a new replicated log that is much more resilient to crashes and other failures. This feature can help to ensure that data is always safe and available, even in the event of an unexpected shutdown. Finally, MariaDB 10.6 includes several improvements to SQL compatibility, making porting applications and data from other database systems easier. MariaDB 10.6 is a significant step forward for the popular open source database and will provide substantial benefits for users looking for a high-performance, scalable, and feature-rich option.

In the following tutorial, you will learn how to install MariaDB 10.6 on AlmaLinux 9 using the official RPM repository straight from MariaDB.org to have the latest updates and security fixes for the 10.6 series.

Update AlmaLinux

First, update your system to ensure all existing packages are up to date before proceeding with the tutorial.

sudo dnf upgrade --refresh

Import MariaDB 10.6 Repository

Installing the latest version of MariaDB 10.6 is straightforward using the official bash script, as any updates will be instant once deployed to the official repositories.

First, ensure the curl package is installed using the following command.

sudo dnf install curl -y

Next, in your terminal, use the following command.

curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.6

Example output:

example-output-adding-mariadb-10.6-repo-almalinux-9

Install MariaDB 10.6

To install MariaDB, you must install the client and the server packages. This can be done as follows:

sudo dnf install mariadb-server mariadb

Alternatively, you can install the following extras.

sudo dnf install mariadb-backup MariaDB-devel -y

More additional packages for MariaDB from the MariaDB.org repository can be found with a simple search command.

dnf search MariaDB*

Example output:

========================== Name & Summary Matched: MariaDB* ===========================

MariaDB.src : MariaDB: a very fast and robust SQL database server

MariaDB-client.x86_64 : MariaDB database client binaries

MariaDB-columnstore-engine.x86_64 : MariaDB ColumnStore storage engine

MariaDB-common.x86_64 : MariaDB database common files (e.g.

: /etc/mysql/conf.d/mariadb.cnf)

MariaDB-devel.x86_64 : MariaDB database development files

MariaDB-server.x86_64 : MariaDB database server binaries

MariaDB-test.x86_64 : MariaDB database regression test suite

mariadb-embedded.x86_64 : MariaDB as an embeddable library

=============================== Name Matched: MariaDB* ================================

MariaDB-backup.x86_64 : Backup tool for MariaDB server

MariaDB-backup-debuginfo.x86_64 : Debug information for package MariaDB-backup

MariaDB-client-debuginfo.x86_64 : Debug information for package MariaDB-client

MariaDB-columnstore-engine-debuginfo.x86_64 : Debug information for package

: MariaDB-columnstore-engine

MariaDB-common-debuginfo.x86_64 : Debug information for package MariaDB-common

MariaDB-connect-engine.x86_64 : Connect storage engine for MariaDB

MariaDB-connect-engine-debuginfo.x86_64 : Debug information for package

: MariaDB-connect-engine

MariaDB-cracklib-password-check.x86_64 : CrackLib Password Validation Plugin for

: MariaDB

MariaDB-cracklib-password-check-debuginfo.x86_64 : Debug information for package

: MariaDB-cracklib-password-check

MariaDB-devel-debuginfo.x86_64 : Debug information for package MariaDB-devel

MariaDB-gssapi-server.x86_64 : GSSAPI authentication plugin for MariaDB server

MariaDB-gssapi-server-debuginfo.x86_64 : Debug information for package

: MariaDB-gssapi-server

MariaDB-oqgraph-engine.x86_64 : OQGraph storage engine for MariaDB

MariaDB-oqgraph-engine-debuginfo.x86_64 : Debug information for package

: MariaDB-oqgraph-engine

MariaDB-rocksdb-engine.x86_64 : RocksDB storage engine for MariaDB

MariaDB-rocksdb-engine-debuginfo.x86_64 : Debug information for package

: MariaDB-rocksdb-engine

MariaDB-s3-engine.x86_64 : Amazon S3 archival storage engine for MariaDB

MariaDB-s3-engine-debuginfo.x86_64 : Debug information for package MariaDB-s3-engine

MariaDB-server-debuginfo.x86_64 : Debug information for package MariaDB-server

MariaDB-shared.x86_64 : LGPL MariaDB database client library

MariaDB-shared-debuginfo.x86_64 : Debug information for package MariaDB-shared

MariaDB-test-debuginfo.x86_64 : Debug information for package MariaDB-test

Confirm the installation of MariaDB by checking the version and build.

mariadb --version

Example output:

mariadb  Ver 15.1 Distrib 10.6.9-MariaDB, for Linux (x86_64) using  EditLine wrapper

Enable MariaDB 10.6 Service

By default, MariaDB is not enabled or activated. To fix this, use the following command.

sudo systemctl enable mariadb --now

Now you have installed MariaDB, and you can verify the status of the database software by using the following systemctl command.

systemctl status mariadb

Example:

example-output-adding-mariadb-10.6-repo-almalinux-9

By default, you will find MariaDB status to be activated. If not, start MariaDB using the following command.

sudo systemctl start mariadb

Stop MariaDB:

sudo systemctl stop mariadb

Enable MariaDB on system startup:

sudo systemctl enable mariadb

Disable MariaDB on system startup:

sudo systemctl disable mariadb

Restart the MariaDB service:

sudo systemctl restart mariadb

Run MariaDB 10.6 Security Script

When installing MariaDB fresh, default settings are considered weak by most standards and cause concern for potentially allowing intrusion or exploiting hackers. A solution is to run the installation security script with the MariaDB installation.

First, use the following command to launch the (mysql_secure_installation).

sudo mysql_secure_installation

Next, follow below:

  • Setting the password for root accounts.
  • Removing root accounts that are accessible from outside the “localhost.”
  • Removing anonymous-user accounts.
  • Removing the test database, which anonymous users can access by default.

Note that you use (Y) to remove everything.

Example:

[joshua@alamlinux-9 ~]$ sudo mariadb-secure-installation



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!



In order to log into MariaDB to secure it, we'll need the current

password for the root user. If you've just installed MariaDB, and

haven't set the root password yet, you should just press enter here.



Enter current password for root (enter for none):

OK, successfully used password, moving on...



Setting the root password or using the unix_socket ensures that nobody

can log into the MariaDB root user without the proper authorisation.



You already have your root account protected, so you can safely answer 'n'.



Switch to unix_socket authentication [Y/n] Y <---- Type Y then press the ENTER KEY.

Enabled successfully!

Reloading privilege tables..

... Success!





You already have your root account protected, so you can safely answer 'n'.



Change the root password? [Y/n] Y <---- Type Y then press the ENTER KEY.

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!





By default, a MariaDB installation has an anonymous user, allowing anyone

to log into MariaDB without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.



Remove anonymous users? [Y/n] Y <---- Type Y then press the ENTER KEY.

... Success!



Normally, root should only be allowed to connect from 'localhost'. This

ensures that someone cannot guess at the root password from the network.



Disallow root login remotely? [Y/n] Y <---- Type Y then press the ENTER KEY.

... Success!



By default, MariaDB comes with a database named 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.



Remove test database and access to it? [Y/n] Y <---- Type Y then press the ENTER KEY.

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!



Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.



Reload privilege tables now? [Y/n] Y <---- Type Y then press the ENTER KEY.

... Success!



Cleaning up...



All done! If you've completed all of the above steps, your MariaDB

installation should now be secure.



Thanks for using MariaDB!

Run MariaDB Database Tables Upgrade Tool

For users who have upgraded from a previous version of MariaDB, say 10.5, you should use the following steps and run the tool designed to check your tables and fix any issues with the version upgrade.

Run the following command to begin the upgrade, or check that your database tables are ok.

sudo mariadb-upgrade

Example output:

example-output-adding-mariadb-10.6-repo-almalinux-9

I would recommend running this command regardless. As you can see above, if it has been done already, it will state it; if not, you will get a long printout of the tables that will be checked and updated accordingly for MariaDB 10.6 compatibility.

How to Remove (Uninstall) MariaDB 10.6

If you no longer wish to use MariaDB and want to remove it in full, execute the following command:

sudo dnf autoremove mariadb-server mariadb

Note that this command will remove most unused dependencies in the MariaDB installation to help clean up your system.

To remove the bash script repository, use the following command.

sudo rm /etc/yum.repos.d/mariadb.repo

Comments and Conclusion

If you’re looking for a powerful and versatile open-source database, MariaDB 10.6 is worth considering especially being the latest LTS release. The new features and improvements over MariaDB 10.5 LTS release make it an attractive option for businesses of all sizes, and its compatibility with MySQL makes migration relatively easy.

--

--

ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.