DebianDebian Based

How To Install Percona on Debian 12

Install Percona on Debian 12

In this tutorial, we will show you how to install Percona on Debian 12. Percona Server is a high-performance open-source database alternative to MySQL developed by Percona. It offers advanced features for database management, scalability, and reliability while remaining 100% compatible with MySQL.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Percona Server on a Debian 12 (Bookworm).

Prerequisites

  • A server running one of the following operating systems: Debian 12 (Bookworm).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Percona.
  • A user account with sudo privileges to execute administrative commands.

Install Percona on Debian 12 Bookworm

Step 1. Back-Up Existing Databases.

If you currently have MySQL or MariaDB running on your system, it is wise to back up your databases before installing Percona Server. This will allow you to restore your data if needed. You can create compressed archives of your databases like so:

mysqldump -u root -p --all-databases | gzip > /path/to/all-databases.sql.gz

Replace /path/to/ with a safe location for storing the backup file. Repeat this process for each database or use --all-databases to backup everything at once.

Step 2. Removing Other MySQL Implementations.

For a clean install, you may wish to uninstall any existing MySQL or MariaDB packages from Debian. This prevents conflicts with Percona Server files and libraries. Use the following apt purge commands:

sudo apt purge mysql* mariadb*
sudo apt autoremove

Step 3. Keeping your system up to date is crucial for security and performance. Begin by updating your package list and upgrading existing packages:

sudo apt update
sudo apt upgrade

Step 4. Setting Up the Percona Repositories.

Percona provides Debian packages through their own apt repository. This needs to be installed and enabled on your system.

wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb

Install the release package with dpkg:

sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb

Next, enable the ps80 repository for Percona Server 8.0:

sudo percona-release setup ps80

Step 5. Installing Percona on Debian 12.

With the repositories configured, you can now install the Percona Server package from the command line:

sudo apt install percona-server-server-8.0

This will download and install the following components:

  • percona-server-server – The Percona Server daemon (mysqld)
  • percona-server-client – Command line client tools
  • percona-server-common – Shared components like the shared client library
  • percona-server-tokudb – The TokuDB storage engine for compression

You will be prompted to set a new root password during the installation process. Be sure to pick a strong, secure password you can remember. This password will be used when connecting to Percona as the MySQL root user.

Once the installation finishes, the Percona Server daemon will start automatically. You can test it with:

sudo systemctl status percona-server-server-8.0

Step 6. Configuring Percona Server.

After installation, some additional steps help secure and optimize your Percona Server environment.

  • Running mysql_secure_installation

Percona includes a script called mysql_secure_installation for locking down MySQL installations. It is highly recommended you run this. Connect to the MySQL shell as root:

sudo mysql -u root -p

Then launch the script:

mysql> mysql_secure_installation

This will guide you through important security configurations like:

  • Setting a password validation policy
  • Removing anonymous user accounts
  • Disallowing remote root logins
  • Removing unused databases

Follow the prompts to apply the hardening steps.

  • Performance Tuning

There are a few key configuration options that can help optimize Percona Server performance:

  1. Increase innodb_buffer_pool_size – This setting controls the memory allocated to cache indexes and data for InnoDB tables. Generally, you’ll want to set this to 60-80% of total system memory.
  2. Set a dedicated buffer pool instance for redo logs – Creating a separate 8MB buffer pool just for redo logs can improve write performance substantially:
innodb_buffer_pool_instances=2
innodb_buffer_pool_size=12G # Total minus 8MB
innodb_redo_log_buffer_size=8M
  1. Adjust the flush method – In most cases the O_DIRECT flush method is ideal. This bypasses the OS cache for increased efficiency.

There are many other advanced configuration flags that can help optimize specific workloads. Percona provides additional tuning advice in their documentation.

Congratulations! You have successfully installed Percona. Thanks for using this tutorial to install the latest version of the Percona Server on Debian 12 Bookworm. 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