RHEL BasedRocky Linux

How To Install Percona on Rocky Linux 10

Install Percona on Rocky Linux 10

Percona Server stands out as one of the most powerful alternatives to MySQL, offering enhanced performance, scalability, and enterprise-grade features that database administrators truly appreciate. If you’re running Rocky Linux 10 and looking for a robust database solution that delivers both reliability and speed, this comprehensive guide will walk you through every step of the installation process.

Rocky Linux 10, being a RHEL-compatible distribution, provides the perfect foundation for Percona Server deployment. This tutorial covers everything from system preparation to post-installation optimization, ensuring your database environment is production-ready from day one.

Prerequisites and System Requirements

Before diving into the installation, ensure your system meets the necessary requirements. You’ll need root or sudo user access to execute administrative commands. A fresh Rocky Linux 10 installation is ideal, as it minimizes potential conflicts with existing database software.

Your server should have at least 2 CPU cores, though 4 or more cores are recommended for production environments. RAM requirements start at 2GB minimum, but 4-8GB provides better performance for real-world workloads. Allocate at least 20GB of disk space, with 60GB or more for production deployments.

An active internet connection is essential for downloading packages and dependencies. You’ll also need SSH access to your server and basic familiarity with Linux command-line operations. Having a text editor like vi, vim, or nano at your disposal will help during configuration steps.

Understanding Percona Server

Percona Server is an open-source, MySQL-compatible database server that brings significant improvements to the standard MySQL offering. Developed and maintained by Percona, this enhanced alternative maintains 100% compatibility with MySQL applications while delivering superior performance and additional enterprise features.

The XtraDB storage engine provides improved InnoDB performance, making database operations faster and more efficient. Enhanced query response times and better scalability mean your applications can handle more concurrent users without degradation. Advanced backup capabilities through Percona XtraBackup enable hot backups without blocking production traffic.

Additional benefits include thread pooling for better connection handling, PAM and LDAP authentication support, comprehensive audit logging, and improved crash recovery mechanisms. These features make Percona Server an excellent choice for demanding production environments.

Step 1: Preparing Your Rocky Linux 10 System

System preparation ensures a smooth installation process. Start by updating your Rocky Linux 10 system to the latest packages. Open your terminal and execute:

sudo dnf check-update
sudo dnf upgrade -y

This update process resolves potential dependency conflicts and ensures your system has the latest security patches. The upgrade might take several minutes depending on how many packages require updates.

Next, disable any conflicting MySQL modules that ship with Rocky Linux. The default MySQL module can interfere with Percona installation, so disable it with:

sudo dnf module disable mysql -y

If you have any existing MySQL installations, remove configuration files to prevent conflicts:

sudo rm -rf /etc/my.cnf

Check that no MySQL processes are currently running on your system. This step prevents port conflicts and ensures a clean installation environment.

Step 2: Installing the Percona Repository

Percona maintains dedicated repositories for their software packages. Installing the percona-release package provides access to all Percona products and simplifies future updates.

Download and install the percona-release package directly from Percona’s repository:

sudo dnf install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm

This package installs the percona-release command utility, which manages repository configurations. The utility streamlines the process of enabling specific Percona product repositories.

Configure the repository for Percona Server 8.0, the current stable release:

sudo percona-release setup ps80 -y

The ps80 designation refers to Percona Server 8.0. Alternative versions include ps57 for version 5.7 or ps-innovation for cutting-edge releases. The setup command automatically configures the appropriate repository files in /etc/yum.repos.d/.

Verify the repository installation by checking available Percona repositories:

sudo dnf repolist | grep percona

You should see Percona repositories listed in the output. Search for available Percona packages to confirm everything is configured correctly:

sudo dnf search percona-server

Step 3: Installing Percona Server Packages

With repositories configured, you’re ready to install Percona Server. The installation includes both server and client components:

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

The percona-server-server package contains the main database server binary and essential utilities. The percona-server-client package provides command-line tools for database interaction. DNF automatically resolves dependencies, typically installing 15-20 related packages.

Installation time varies based on your internet connection speed and system performance. The packages install to standard locations: binaries go to /usr/bin/, configuration files to /etc/, and data files to /var/lib/mysql/.

Consider installing optional but valuable complementary packages. Percona XtraBackup enables hot backups without locking tables:

sudo dnf install -y percona-xtrabackup-80

Percona Toolkit provides a collection of advanced administrative utilities:

sudo dnf install -y percona-toolkit

These tools prove invaluable for database maintenance, backup operations, and performance analysis. Verify package installation with:

rpm -qa | grep percona

Step 4: Starting and Enabling Percona Service

Percona Server operates as a systemd service on Rocky Linux 10. Start the service with:

sudo systemctl start mysqld

The first startup initializes the database, creates system tables, and generates a temporary root password. Check service status to confirm successful startup:

sudo systemctl status mysqld

The output should show “active (running)” in green. Locate the temporary root password in the MySQL error log:

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

Copy this password carefully—you’ll need it for the security configuration step. The temporary password contains random characters and appears after “A temporary password is generated for root@localhost:”.

Enable automatic startup on system boot to ensure Percona Server starts automatically after reboots:

sudo systemctl enable mysqld

Verify the service is enabled:

sudo systemctl is-enabled mysqld

The command should return “enabled”. This configuration ensures your database remains available after system maintenance or unexpected restarts.

Step 5: Securing Your Percona Installation

Database security requires immediate attention after installation. Percona includes the mysql_secure_installation script for initial security configuration.

Run the security script:

sudo mysql_secure_installation

The script presents several security prompts. First, enter the temporary root password you retrieved from the log file. You’ll immediately be prompted to set a new, strong root password. Choose a complex password combining uppercase letters, lowercase letters, numbers, and special characters.

The password validation plugin enforces password strength policies. Strong passwords significantly reduce the risk of unauthorized access.

The script asks whether to remove anonymous users. Anonymous users represent a security risk because they allow anyone to log into MySQL without authentication. Answer “Yes” to remove them.

Next, decide whether to disallow remote root login. For security, root should only connect from localhost. Answer “Yes” unless you have specific requirements for remote root access.

The script offers to remove the test database, which is accessible to all users by default. Remove it by answering “Yes”—it serves no purpose in production environments.

Finally, reload privilege tables to ensure all changes take immediate effect. Answer “Yes” to this prompt.

Additional security hardening strengthens your database environment. Edit the main configuration file to restrict network access:

sudo nano /etc/my.cnf

Add or modify the bind-address directive under the [mysqld] section:

[mysqld]
bind-address = 127.0.0.1

This configuration restricts MySQL to accept connections only from localhost. For multi-server environments, specify your server’s IP address instead. Set proper file permissions on configuration files to prevent unauthorized modifications:

sudo chmod 644 /etc/my.cnf

Consider implementing SSL/TLS for encrypted connections in production environments. Regular security updates keep your installation protected against vulnerabilities.

Step 6: Configuring Firewall Rules

Rocky Linux 10 uses firewalld for network security. Open the MySQL port to allow database connections:

sudo firewall-cmd --add-port=3306/tcp --permanent

The –permanent flag ensures the rule persists after system reboots. Reload firewall rules to activate changes:

sudo firewall-cmd --reload

Verify your firewall configuration:

sudo firewall-cmd --list-all

Port 3306 should appear in the ports list. For enhanced security, restrict database access to specific IP addresses or subnets. Create a rich rule allowing connections only from trusted sources:

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port=3306 protocol=tcp accept'
sudo firewall-cmd --reload

Replace “192.168.1.0/24” with your actual trusted network range. This approach prevents unauthorized connection attempts from unknown sources.

Step 7: Verifying Installation

Confirm Percona Server is functioning correctly by logging into the MySQL shell:

mysql -u root -p

Enter the root password you set during mysql_secure_installation. Once connected, check the installed version:

SELECT VERSION();

The output displays the Percona Server version, confirming successful installation. List available databases:

SHOW DATABASES;

You should see system databases including mysql, information_schema, performance_schema, and sys. Check server status:

STATUS;

Exit the MySQL shell:

EXIT;

Verify network connectivity by checking listening ports:

sudo ss -tulpn | grep 3306

The output confirms Percona Server is listening on port 3306. Review system resource usage:

systemctl status mysqld

Check error logs for any issues:

sudo tail -f /var/log/mysqld.log

Press Ctrl+C to exit the log view. These verification steps confirm your Percona Server installation is operational and ready for configuration.

Post-Installation Configuration

Optimize Percona Server for your specific workload by editing configuration files. The main configuration file resides at /etc/my.cnf, with additional configuration directories under /etc/percona-server.conf.d/.

Edit the main configuration file:

sudo nano /etc/my.cnf

Key configuration parameters to adjust:

max_connections: Controls the maximum number of simultaneous client connections. Default is 151; increase for high-traffic applications.

innodb_buffer_pool_size: The most critical performance parameter. Set to 50-70% of available RAM for dedicated database servers. For example, on an 8GB server, set this to 4-5GB.

character_set_server: Set to utf8mb4 for full Unicode support including emoji and special characters.

Add these lines under the [mysqld] section:

[mysqld]
max_connections = 200
innodb_buffer_pool_size = 4G
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci

After modifying configuration files, restart Percona Server:

sudo systemctl restart mysqld

Verify configuration changes took effect:

mysql -u root -p -e "SHOW VARIABLES LIKE 'max_connections';"

Create a database and user for your applications. Log into MySQL:

mysql -u root -p

Create a new database:

CREATE DATABASE myapp_db;

Create an application user with appropriate privileges:

CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'StrongP@ssw0rd!';
GRANT ALL PRIVILEGES ON myapp_db.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES;

Exit and test the new user connection:

mysql -u appuser -p myapp_db

This approach follows security best practices by avoiding root user access for applications.

Performance Optimization and Monitoring

Performance optimization ensures your database operates efficiently under load. Monitor buffer pool usage and adjust innodb_buffer_pool_size based on actual memory utilization. Configure the slow query log to identify problematic queries:

slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-query.log
long_query_time = 2

This configuration logs queries taking longer than 2 seconds. Enable the performance_schema for detailed metrics:

performance_schema = ON

Consider installing Percona Monitoring and Management (PMM) for comprehensive monitoring and query analytics. PMM provides real-time performance insights and helps identify optimization opportunities.

Regular maintenance tasks include analyzing tables to update statistics:

ANALYZE TABLE table_name;

Optimize tables to reclaim space and improve performance:

OPTIMIZE TABLE table_name;

Implement proper indexing strategies based on your query patterns. Use EXPLAIN to analyze query execution plans and identify missing indexes.

Troubleshooting Common Issues

Installation problems sometimes occur despite following procedures carefully. Repository connection failures typically indicate internet connectivity issues or incorrect repository URLs. Verify your network connection and check repository configuration in /etc/yum.repos.d/.

Package dependency conflicts often result from existing MySQL installations. Ensure MySQL modules are disabled before installing Percona. Check for running MySQL processes and stop them before proceeding.

Service startup failures require log investigation. Check /var/log/mysqld.log for detailed error messages. Common causes include data directory permission problems, insufficient memory, or configuration syntax errors.

Data directory permission issues occur when files aren’t owned by the mysql user:

sudo chown -R mysql:mysql /var/lib/mysql/

Port binding failures indicate another service is using port 3306. Identify the conflicting process:

sudo ss -tulpn | grep 3306

SELinux policies on Rocky Linux sometimes block MySQL operations. Check audit logs for SELinux denials:

sudo ausearch -m avc -ts recent

Temporarily set SELinux to permissive mode for testing:

sudo setenforce 0

If this resolves the issue, configure appropriate SELinux policies rather than permanently disabling SELinux.

Backup and Maintenance Strategy

Implement regular backups using Percona XtraBackup for hot, non-blocking backups. Install XtraBackup if you haven’t already:

sudo dnf install -y percona-xtrabackup-80

Create full backups with:

sudo xtrabackup --backup --target-dir=/backup/full

Schedule automated backups using cron. Edit the cron table:

sudo crontab -e

Add a daily backup at 2 AM:

0 2 * * * /usr/bin/xtrabackup --backup --target-dir=/backup/$(date +\%Y\%m\%d)

Test backup restoration regularly to ensure backup integrity. Monitor disk space for binary logs and backup storage. Configure binary logging for point-in-time recovery:

log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 7

Keep Percona Server updated with the latest security patches:

sudo dnf update percona-server-server

Subscribe to Percona security announcements to stay informed about critical updates. Document your configuration and maintenance procedures for team reference.

Congratulations! You have successfully installed Percona. Thanks for using this tutorial for installing the Percona database on your Rocky Linux 10 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