19.Laptop Bed Esm W900

MariaDB is an open-source, relational database system that's widely used as a replacement for MySQL. It is a powerful database management system with strong security features and a flexible design. This makes it suitable for many applications. This tutorial will walk you through the installation of MariaDB on Ubuntu 24, a stable and recent release of one of the most popular Linux Distributions.

This guide will help you set up MariaDB on your Ubuntu system, whether you are setting up a website server, cloud application or simply experimenting with database administration.

This tutorial will teach you:

  • How to update the package indexes in your system
  • Install MariaDB
  • How to enable MariaDB startup on boot and check its status
  • Securing your MariaDB installation

Installing MariaDB on Ubuntu 24.04

Business CybersecurityUse these steps to configure and install MariaDB on Ubuntu 24.04. These steps ensure that your MariaDB is secure and up-to-date.

Update Package Indexes: It's essential to update the package indexes of your system before installing any new packages. You can then install the latest packages and dependencies.

$ sudo apt update

This command only updates the list and versions of packages available, it does not upgrade or install any packages.

Install MariaDB: You can install MariaDB after the package lists have been updated.

sudo apt install mariadb-server

This command will install MariaDB and all its dependencies. You may be asked for confirmation during the installation. Press 'Y" to continue.

Check MariaDB Status and Enable it: It's good to check on the MariaDB status after installation. You should also enable MariaDB to start automatically when the system boots.

$ sudo systemctl status mariadb

This command will check the status of MariaDB. The output should indicate that the MariaDB service is running and active.

$ sudo systemctl enable mariadb

This command allows MariaDB to be started automatically at system startup.

Secure the Installation: The 'mysql_secure_installation' script is a critical step in securing your MariaDB installation. This script will walk you through a series of options that you can use to improve the security of your MariaDB installation. The script will guide you through several options to enhance the security of your MariaDB server.

It will also allow you to remove the "test" database. This is recommended in a production setting. You'll then be asked to reload the privilege tables in order to make changes instantly. Consider each option carefully based on the security requirements and server environment.

$ sudo mysql_secure_installation

Securing your MariaDB installation with the mysql_secure_installation script involves several key decisions. It's important to create a password for the root user if you've not already done so. This will ensure basic database security. If MariaDB's root user is the same as that of your system, it is best to switch to Unix_socket Authentication for increased security. However, this can be skipped depending on your remote access needs. It is always recommended to delete anonymous users in order to prevent unauthorized access to the database.

Preventing root login from a remote location can also be a crucial step to mitigate brute-force attacks. You should take this into consideration unless you need remote administration. It is recommended that you remove the "test" database, which is available by default. This poses a serious security risk. After making the changes, reload the privilege tables to ensure that they take effect immediately. These steps will help protect your MariaDB installation from common security threats.

Final Thoughts on Installing & Securing MariaDB on Ubuntu 24.04

Following these steps will allow you to install and secure MariaDB on Ubuntu 24.04 successfully. This setup is a great foundation for any database requirements, whether you use it for production, development, or testing. To get the most recent features and security upgrades, you should update MariaDB and your system regularly. MariaDB is a great tool that we strongly recommend!

Have additional questions? Connect with us on X @lnxsec - we're here to help!

FAQs: How To Install and Secure MariaDB on Ubuntu 24.04

  1. What is MariaDB?

    MariaDB, an open-source relational management database system forked from MySQL, is known for its reliability, performance, and ease of usage.

  2. MariaDB is compatible with MySQL.

    MariaDB can replace MySQL directly in the majority of cases.

  3. How do I install MariaDB in Ubuntu 24.04?

    Install MariaDB using the command sudo install mariadb server on Ubuntu 24.04.

  4. How can I verify if MariaDB has been successfully installed?

    Run sudo mariadb after installation, verify that the service is running.

  5. Why should I run the 'mysql_secure_installation' script?

    This script is essential for removing insecure default settings, such as anonymous users and remote root log-in.

  6. Should I set up a root password when installing MariaDB?

    It is recommended that you set a strong password for your database.

  7. What is the unix_socket Authentication in MariaDB?

    Unix_socket Authentication allows MariaDB root users to login only when system users are also root. This increases security.

  8. How can I remove anonymous users from MariaDB?

    This can be done through the 'mysql_secure_installation' script by answering 'Y' when prompted.

  9. Is it safe for me to disable root access remotely?

    It is recommended to disable root login remotely for security reasons unless you need remote administration.

  10. Why should I remove my 'test' MariaDB database?

    By default, the 'test' database is available and should be removed in order to prevent unauthorized access.

  11. How can I make MariaDB start automatically when the computer boots?

    Use the command systemctl enabled mariadb if you want MariaDB to start when your computer boots automatically.

  12. Can I encrypt my data in MariaDB?

    MariaDB can support data encryption both at the column level as well as through Transparent Data Encryption.

  13. How can I upgrade MariaDB to its latest version?

    To keep MariaDB up-to-date, run sudo update or sudo upgrade regularly.

  14. How do I backup my MariaDB database?

    Regularly back up your database using tools such as mysqldump and MariaDB backup utilities.

  15. What is MariaDB, and where can I get more information?

    For comprehensive information, visit the MariaDB official website and documentation.