MariaDB is a popular open-source database management system that is widely used for its reliability, performance, and robust features. Installing MariaDB on AlmaLinux 9 is a straightforward process, even for newcomers. This detailed guide will walk you through the installation and basic configuration of MariaDB on AlmaLinux 9, assuming you are using the root user.
Step 1: Access the Resources page
- Navigate to the “Resources” page in the cloud provider’s dashboard.
- Click on the “Create” button in the top right corner.
Step 2: Choose “Add New Instance”
- In the “Create an instance” section, click on the “Add New Instance” option.

Step 3: Select a location
- Choose your preferred data center location from the options provided.
- In this example, “London, United Kingdom” is selected.

Step 4: Choose a plan
- Select the “Standard” plan, which is described as a “Starter Performance Solution”.
- Choose your desired configuration. In this case, a plan with 2 Cores CPU, 4 GB Memory, 80 GB SSD disk space, and 4000 GB bandwidth is selected for $22 per month.

Step 5: Select an operating system
- Choose your preferred operating system from the “Distributions” tab.
- In this example, “AlmaLinux 9” is selected.
Step 6: Configure network settings
- Select “Basic” for the Network Type, which assigns a public IP address to the instance.
Step 7: Set up authentication
- Choose between SSH keys or Password authentication.
- In this case, “Password” is selected to receive a root password for accessing the instance.

Step 8: Additional options and finalization
- Review any additional options if needed.
- Set the number of instances you want to deploy (1 in this case).
- Choose a hostname for your instance. The default suggestion is “AlmaLinux-S-5-2vcpus-4gb-EMEA-UK-01-1”.
- Review the backup options if available.
Step 9: Create the instance
- Click the “Create Instance” button at the bottom of the page to finalize and deploy your new cloud server instance.
Would you like me to explain or elaborate on any of these steps?

Step 10: Connecting to Your Instance
- Retrieve SSH Credentials:
- Find the IP address of your newly created instance on the Shape.host dashboard. This should be displayed in the instance details or overview page.
- Connect via SSH:
- Open a terminal on your local machine.
- Use the following command to connect to your instance:
ssh root@your_instance_ip
- Replace
your_instance_ip
with the actual IP address of your instance. - When prompted, enter the root password you received during the instance creation process.
Step 11: Update System Packages
Before installing MariaDB, ensure your system packages are up-to-date. Open your terminal and run the following commands:
dnf update -y

Step 12: Install MariaDB
AlmaLinux 9 uses the DNF package manager, which makes it easy to install MariaDB from the official repositories.
Install the MariaDB Server
Execute the following command to install MariaDB:
dnf install -y mariadb-server

Start and Enable MariaDB
Once the installation is complete, start the MariaDB service and enable it to start on boot:
systemctl start mariadb
systemctl enable mariadb

Verify the Installation
To check if MariaDB is running, use the following command:
systemctl status mariadb

You should see an output indicating that the MariaDB service is active and running.
Step 13: Secure the MariaDB Installation
MariaDB comes with a security script to enhance the security of your installation. Run the following command to initiate the script:
mysql_secure_installation

You will be prompted with several questions to configure the security settings:
- Set the root password: Enter a strong password for the MariaDB root user.
- Remove anonymous users: Type
Y
and press Enter. - Disallow root login remotely: Type
Y
and press Enter. - Remove the test database: Type
Y
and press Enter. - Reload privilege tables: Type
Y
and press Enter.
These steps help secure your MariaDB installation by removing insecure default settings.
Step 14: Configure MariaDB
Now that MariaDB is installed and secured, you can perform some basic configurations.
Log in to MariaDB
Log in to the MariaDB shell using the root user:
mysql -u root -p

Enter the root password you set during the secure installation process.
Create a New Database and User
To create a new database and user, follow these steps:
CREATE DATABASE mydatabase;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace mydatabase
, myuser
, and mypassword
with your preferred database name, username, and password.
Test the New User
Log in as the new user to verify the setup:
mysql -u myuser -p

Enter the password for the new user and verify you can access the database:
SHOW DATABASES;

You should see the mydatabase
in the list of databases.
Step 5: Adjust Firewall Settings
If your server is running a firewall, you’ll need to allow MariaDB traffic. Use the following commands to open the necessary ports:
firewall-cmd --permanent --zone=public --add-service=mysql
firewall-cmd --reload
Step 6: Optimize MariaDB Configuration
For better performance and reliability, you might want to adjust some settings in the MariaDB configuration file located at /etc/my.cnf.d/mariadb-server.cnf
.
Open the file with a text editor:
nano /etc/my.cnf.d/mariadb-server.cnf

Make any necessary adjustments based on your requirements. After making changes, restart the MariaDB service:
systemctl restart mariadb

By following these steps, you will have a fully functional MariaDB server running on AlmaLinux 9, ready to handle your database needs.
For enhanced performance and reliability, consider using Shape.Host’s Linux SSD VPS services. Shape.Host offers robust solutions for hosting your MariaDB databases in the cloud, providing high availability, security, and scalability for your data management needs. Explore more about their services at Shape.Host.