In this tutorial, we will show you how to install MariaDB on AlmaLinux 8. For those of you who didn’t know, the MariaDB database is an open-source relational database management system, backward compatible, binary drop-in replacement of MySQL. It is developed by some of the original developers of MySQL and by many people in the community.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MariaDB on AlmaLinux 8. You can follow the same instructions for Rocky Linux.
- A server running one of the following operating systems: AlmaLinux 8, CentOS, and Rocky Linux 8.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install MariaDB on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf install epel-release
Step 2. Installing MariaDB on AlmaLinux 8.
MariaDB is a popular database server. Now we install the MariaDB database server with the following command below:
sudo dnf install mariadb-server mariadb
[firstname.lastname@example.org ~]# dnf install mariadb-server mariadb Last metadata expiration check: 1:36:16 ago on Mon 26 Jul 2021 12:25:36 AM EDT. Dependencies resolved. ================================================================================ Package Arch Version Repo Size ================================================================================ Installing: mariadb-server x86_64 3:10.3.28-1.module_el8.3.0+2177+7adc332a appstream 16 M Installing dependencies: libaio x86_64 0.3.112-1.el8 baseos 32 k mariadb x86_64 3:10.3.28-1.module_el8.3.0+2177+7adc332a appstream 6.0 M
Once the installation is complete, start to enable it to start on system start-up using:
sudo systemctl restart mariadb sudo systemctl status mariadb sudo systemctl enable mariadb
By default, MariaDB is not hardened. You can secure MariaDB using the
mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
Configure it like this:
- Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
To log into MariaDB, use the following command (note that it’s the same command you would use to log into a MariaDB database):
mysql -u root -p
Step 3. Configure Firewall.
If you want to access your Database using some other system and GUI or CLI client then, we have to first open its service or port in our system firewall:
sudo firewall-cmd --permanent --add-service=mysql sudo firewall-cmd --reload
Congratulations! You have successfully installed MariaDB. Thanks for using this tutorial for installing the MariaDB server database on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official MariaDB website.