How to Install and Configure Secure MariaDB 11 on Debian 12
MariaDB is a robust relational database management system, and securing its installation on Debian 12 is crucial for protecting your data. This guide will walk you through the process of installing and configuring MariaDB 11 with a focus on security.
Step 1: Update Your System
Before proceeding with the installation, ensure that your Debian 12 system is up-to-date by running the following commands in the terminal:
sudo apt update sudo apt upgrade
Step 2: Install MariaDB 11
The latest version of MariaDB 11 might not be available in the default Debian repositories. To add the official MariaDB repository, follow these steps:
2.1 Add the MariaDB Repository
sudo apt-get install software-properties-common sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' sudo add-apt-repository 'deb [arch=amd64] http://mirror.netcologne.de/mariadb/repo/11/debian buster main'
2.2 Install MariaDB 11
sudo apt update sudo apt install mariadb-server
Step 3: Secure MariaDB Installation
After the installation, secure your MariaDB installation by running the following command:
Follow the on-screen prompts to set the root password, remove anonymous users, disallow root login remotely, and remove the test database. These steps enhance the overall security of your MariaDB server.
Step 4: Configure MariaDB Access Rights
Create a dedicated user for database administration and grant the necessary privileges. Open the MariaDB shell:
Create a new user and grant them privileged access:
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'YourPassword'; GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
Replace ‘admin’ with your desired username and ‘YourPassword’ with a strong password.
Step 5: Firewall Configuration
Activate the firewall and configure it to allow traffic only to the MariaDB port, which is typically 3306.
sudo ufw allow 3306 sudo ufw enable
You have now successfully installed and securely configured MariaDB 11 on your Debian 12 system. Security is paramount for your database, and by following this guide, you’ve established a solid foundation for a protected database environment. Remember to regularly back up your databases and keep your systems updated for ongoing security improvements.