AlmaLinuxRHEL Based

How To Install Percona on AlmaLinux 9

Install Percona on AlmaLinux 9

In the world of database management systems, Percona stands out as a powerful, open-source alternative to traditional MySQL. As businesses and organizations increasingly rely on robust, scalable, and high-performance database solutions, Percona has gained popularity for its enhanced features and optimizations. This guide will walk you through the process of installing Percona on AlmaLinux 9, a stable and enterprise-ready Linux distribution that serves as an excellent platform for database servers.

Whether you’re a database administrator, a system engineer, or a curious tech enthusiast, this article aims to provide you with a comprehensive, step-by-step approach to setting up Percona on AlmaLinux 9. We’ll cover everything from understanding the basics to troubleshooting common issues, ensuring you have all the knowledge needed to successfully deploy Percona in your environment.

Understanding Percona and AlmaLinux 9

What is Percona?

Percona is a suite of open-source database software solutions that enhance and build upon MySQL technology. It offers improved performance, scalability, and instrumentation compared to standard MySQL distributions. Percona Server, the core product we’ll be installing, is a drop-in replacement for MySQL that provides significant performance improvements and additional features.

Key Features and Benefits of Percona

  • Enhanced performance and scalability
  • Improved diagnostics and monitoring capabilities
  • Advanced security features
  • Better resource utilization
  • Compatibility with MySQL ecosystem

Prerequisites

Before we dive into the installation process, let’s ensure you have everything needed to successfully install Percona on AlmaLinux 9:

  • A system running AlmaLinux 9 with at least 2GB of RAM and 10GB of free disk space
  • Root or sudo access to the system
  • A stable internet connection for downloading packages
  • Basic familiarity with Linux command-line operations

Preparing the System

To ensure a smooth installation process, we’ll start by preparing our AlmaLinux 9 system. This involves updating the system, installing necessary dependencies, and configuring some system settings.

Updating AlmaLinux 9

First, let’s update the system to ensure we have the latest packages and security updates:

sudo dnf update -y

Installing Dependencies

Percona requires certain packages to be installed. Let’s install these dependencies:

sudo dnf install -y wget epel-release

Configuring Firewall Settings

If you have the firewall enabled, you’ll need to allow traffic on the MySQL port (default 3306). Run the following commands:

sudo firewall-cmd --add-service=mysql --permanent
sudo firewall-cmd --reload

Disabling SELinux (if necessary)

SELinux can sometimes interfere with database operations. While it’s generally recommended to keep SELinux enabled and configure it properly, you may need to disable it temporarily for troubleshooting. To disable SELinux:

sudo setenforce 0

To make this change permanent, edit the /etc/selinux/config file and set SELINUX=disabled. Remember to reboot your system for the changes to take effect.

Installing Percona Repository

Before we can install Percona Server, we need to add the Percona repository to our system. This repository contains the necessary packages for Percona products.

Downloading the Percona Repository Package

Use the following command to download the Percona repository package:

wget https://repo.percona.com/yum/percona-release-latest.noarch.rpm

Installing the Repository

Now, let’s install the repository package:

sudo rpm -ivh percona-release-latest.noarch.rpm

Verifying the Repository Installation

To ensure the repository was installed correctly, run:

sudo percona-release setup ps80

This command sets up the repository for Percona Server 8.0, which is the latest stable version at the time of writing.

Installing Percona Server

With the repository set up, we can now proceed to install Percona Server on our AlmaLinux 9 system.

Choosing the Appropriate Percona Server Version

In this guide, we’ll install Percona Server 8.0, which is the latest stable version. However, you should always check the Percona website for the most up-to-date version information and choose the one that best fits your requirements.

Installing Percona Server Using dnf

To install Percona Server and its components, run the following command:

sudo dnf install -y percona-server-server percona-server-client percona-server-devel

This command installs the Percona Server, client utilities, and development libraries.

Verifying the Installation

After the installation is complete, you can verify it by checking the version of the installed Percona Server:

mysqld --version

This should display the version information for Percona Server.

Configuring Percona Server

With Percona Server installed, we need to perform some initial configuration steps to secure our installation and optimize it for our needs.

Initial Configuration Steps

Start by initializing the MySQL data directory:

sudo mysqld --initialize

This command creates the necessary system tables and sets a temporary root password, which you can find in the MySQL error log:

sudo grep 'temporary password' /var/log/mysqld.log

Setting Up the Root Password

Start the MySQL service:

sudo systemctl start mysqld

Now, connect to MySQL using the temporary password:

mysql -u root -p

Once connected, change the root password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_new_password';

Securing the Installation

Percona provides a security script to improve the security of your installation. Run it with:

sudo mysql_secure_installation

Follow the prompts to remove anonymous users, disallow root login remotely, remove test database, and reload privilege tables.

Optimizing Percona Server Settings

The default configuration of Percona Server is generally suitable for most use cases. However, you may want to optimize it based on your specific needs. Edit the configuration file at /etc/my.cnf to make changes. Some common optimizations include:

  • Adjusting the innodb_buffer_pool_size based on your available RAM
  • Setting the max_connections parameter based on expected concurrent connections
  • Configuring query cache settings for improved performance

Remember to restart the MySQL service after making changes:

sudo systemctl restart mysqld

Starting and Enabling Percona Server

Now that we have Percona Server installed and configured, let’s ensure it starts automatically on system boot and verify its status.

Starting the Percona Server Service

If you haven’t already started the service, you can do so with:

sudo systemctl start mysqld

Enabling Percona Server to Start on Boot

To ensure Percona Server starts automatically when your system boots, run:

sudo systemctl enable mysqld

Checking the Service Status

You can verify the status of the Percona Server service with:

sudo systemctl status mysqld

This command will show you whether the service is active (running) and provide some additional information about the service status.

Testing the Percona Installation

To ensure our Percona Server installation is working correctly, let’s perform some basic operations.

Connecting to Percona Server

Connect to Percona Server using the MySQL client:

mysql -u root -p

Enter your root password when prompted.

Creating a Test Database and Table

Once connected, let’s create a test database and table:

CREATE DATABASE testdb;
USE testdb;
CREATE TABLE testtable (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50));
INSERT INTO testtable (name) VALUES ('Test Entry');

Performing Basic Operations

Now, let’s verify our data:

SELECT * FROM testtable;

This should display the entry we just inserted. If you see the results, congratulations! Your Percona Server installation is working correctly.

Troubleshooting Common Issues

Even with careful installation, you might encounter some issues. Here are some common problems and their solutions:

Installation Errors

If you encounter package conflicts or dependency issues during installation, try the following:

  • Ensure your system is up to date: sudo dnf update -y
  • Clear DNF cache: sudo dnf clean all
  • Verify the Percona repository is correctly set up: sudo percona-release show

Configuration Problems

If Percona Server fails to start or you’re experiencing performance issues:

  • Check the MySQL error log: sudo tail -f /var/log/mysqld.log
  • Verify your configuration file (/etc/my.cnf) for syntax errors
  • Ensure you have sufficient system resources (RAM, CPU, disk space)

Connection Issues

If you’re having trouble connecting to Percona Server:

  • Verify the service is running: sudo systemctl status mysqld
  • Check firewall settings: sudo firewall-cmd --list-all
  • Ensure you’re using the correct credentials and host

Congratulations! You have successfully installed Percona. Thanks for using this tutorial for installing the Percona database on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Percona website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button