UbuntuUbuntu Based

How To Install Percona on Ubuntu 24.04 LTS

Install Percona on Ubuntu 24.04

Percona Server for MySQL has emerged as a powerful alternative to traditional MySQL installations, offering enhanced performance, scalability, and diagnostics. As businesses increasingly rely on robust database solutions, Percona stands out for its ability to handle high-traffic websites and complex data operations efficiently. This guide focuses on installing Percona on Ubuntu 24.04 LTS, a long-term support release known for its stability and security.

Percona distinguishes itself from standard MySQL by providing advanced features such as improved query optimization, better resource utilization, and enhanced monitoring capabilities. These attributes make it an attractive choice for organizations seeking to optimize their database performance without compromising on reliability. Ubuntu 24.04 LTS, with its long-term support and regular security updates, provides an ideal platform for deploying Percona, ensuring a stable and secure environment for your database operations.

Prerequisites

Before diving into the installation process, it’s crucial to ensure your system meets the necessary requirements. This preparation will help avoid potential issues and ensure a smooth installation experience.

Hardware Requirements

To run Percona effectively on Ubuntu 24.04 LTS, your system should meet or exceed the following specifications:

  • CPU: 2 cores minimum, 4 cores recommended for production environments
  • RAM: 4GB minimum, 8GB or more recommended for optimal performance
  • Storage: 10GB of free disk space, SSD storage recommended for improved I/O performance

These requirements may vary based on your specific use case and the scale of your database operations. For high-traffic websites or large-scale data processing, consider allocating more resources to ensure smooth performance.

Software Dependencies

Ensure the following software packages are installed on your Ubuntu 24.04 LTS system:

  • curl
  • gnupg2
  • software-properties-common

These packages are essential for adding the Percona repository and managing software installations.

Network Configuration

A stable internet connection is crucial for downloading Percona packages and updates. Additionally, ensure that your firewall settings allow incoming connections on port 3306 (the default MySQL port) if you plan to access the database remotely.

Installing Required Packages

Before installing Percona, update your system’s package index and install the necessary dependencies. Open a terminal and execute the following commands:

sudo apt update
sudo apt install curl gnupg2 software-properties-common -y

These commands update the package lists and install the required tools. The ‘-y’ flag automatically answers yes to prompts, streamlining the installation process.

Adding Percona APT Repository

To install Percona, you need to add its official APT repository to your system. This ensures you receive the latest updates and security patches directly from Percona.

Follow these steps to add the Percona repository:

  1. Download the Percona GPG key:
    curl -O https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
  2. Install the downloaded package:
    sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
  3. Update the package lists:
    sudo apt update
  4. Enable the Percona Server repository:
    sudo percona-release setup ps80

    This command sets up the repository for Percona Server 8.0.

After completing these steps, your system is ready to install Percona Server for MySQL.

Installing Percona Server

With the repository set up, you can now proceed to install Percona Server. This process involves downloading and configuring the Percona packages on your Ubuntu 24.04 LTS system.

Execute the following command to install Percona Server:

sudo apt install percona-server-server

During the installation, you’ll be prompted to set a root password for MySQL. Choose a strong, unique password and make sure to remember it, as you’ll need it for future database management tasks.

To verify the installation, check the status of the Percona Server service:

sudo systemctl status mysql

You should see output indicating that the service is active and running.

Troubleshooting Common Installation Issues

If you encounter any issues during the installation process, consider the following troubleshooting steps:

  • Dependency conflicts: Ensure all system packages are up to date by running sudo apt upgrade before installation.
  • Port conflicts: If another service is using port 3306, you may need to stop that service or configure Percona to use a different port.
  • Installation fails to start: Check the MySQL error log at /var/log/mysql/error.log for specific error messages.

Configuration Post-Installation

After successfully installing Percona Server, it’s important to optimize its configuration for your specific needs. This section covers key areas to focus on for enhancing performance and security.

Performance Optimization

Edit the MySQL configuration file located at /etc/mysql/my.cnf to adjust performance settings:

sudo nano /etc/mysql/my.cnf

Consider the following optimizations:

  • Increase the innodb_buffer_pool_size to utilize more RAM for caching (e.g., set it to 70-80% of your total RAM for dedicated database servers).
  • Adjust max_connections based on your expected concurrent connections.
  • Enable the query_cache_type and set an appropriate query_cache_size for frequently accessed data.

Security Settings

Enhance the security of your Percona installation:

  1. Run the MySQL secure installation script:
    sudo mysql_secure_installation

    This script helps you set a root password, remove anonymous users, and disable remote root login.

  2. Configure SSL for encrypted connections by generating SSL certificates and updating the MySQL configuration.

User Account and Permissions Setup

Create a new user and grant appropriate permissions:

sudo mysql -u root -p
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Replace ‘newuser’ and ‘password’ with your desired username and a strong password.

Testing the Installation

To ensure Percona Server is functioning correctly, perform the following tests:

  1. Connect to the MySQL server:
    mysql -u root -p
  2. Check the server version:
    SELECT VERSION();

    This should display the Percona Server version.

  3. Create a test database and table:
    CREATE DATABASE testdb;
    USE testdb;
    CREATE TABLE testtable (id INT, name VARCHAR(50));
    INSERT INTO testtable VALUES (1, 'Test Entry');
    SELECT * FROM testtable;

If you can perform these operations without errors, your Percona Server installation is working correctly.

Using Percona XtraBackup

Percona XtraBackup is a powerful tool for performing hot backups of MySQL databases without interrupting service. It’s especially useful for large databases where traditional backup methods might cause significant downtime.

Installing Percona XtraBackup

To install Percona XtraBackup, run:

sudo apt install percona-xtrabackup-80

Performing a Backup

To create a full backup of all databases:

sudo xtrabackup --backup --target-dir=/path/to/backup

For incremental backups:

sudo xtrabackup --backup --target-dir=/path/to/incremental --incremental-basedir=/path/to/full-backup

Restoring from a Backup

To restore from a full backup:

sudo xtrabackup --prepare --target-dir=/path/to/backup
sudo xtrabackup --copy-back --target-dir=/path/to/backup

Remember to stop the MySQL service before restoring and adjust file permissions after the restore process.

Congratulations! You have successfully installed Percona. Thanks for using this tutorial for installing the Percona database on Ubuntu 24.04 LTS 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 a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button