Non-interactive DNF installation for Percona Server for MySQL 9.7¶
Automate Percona Server for MySQL installation with DNF on Red Hat Enterprise Linux (RHEL), Rocky Linux, AlmaLinux, or CentOS. Use Ansible, Kickstart, cloud-init, or a continuous integration (CI) image. For an interactive install, see Install using DNF.
Non-interactive installs and DNF¶
The -y flag (or --assumeyes) on dnf or yum skips transaction confirmation prompts. DNF does not use debconf. RPM %post scripts for percona-server-server do not ask for a root password during a fresh install on RHEL and derivatives.
After a fresh install, the server starts with a temporary root password. The password appears in the error log, usually /var/log/mysqld.log. Your automation must read that password and set a permanent one.
Common automation tasks include the following:
-
Disable the distribution MySQL module without prompts
-
Install
percona-releaseand server packages with-y -
Run
percona-releasewith non-interactive flags where supported -
Start the service, read the temporary password, and run
ALTER USER
Lab baseline and package validation¶
Package names and versions depend on the Linux distribution, the release (such as 9.4), and the percona-server-server build. Treat each example as illustrative until you confirm names on a disposable host that matches production.
-
Pick a lab image that matches production. Match repositories, distribution release, and architecture.
-
On the lab host, list available server packages:
dnf search percona-server-server rpm -q percona-server-serverStore the output with your automation. Run the check again after a base-image or package upgrade.
-
For automation, pin the
percona-server-serverversion or record the build fromrpm -q. Pinning ties scripts to a known package.
To automate the install sequence:
-
Use the DNF steps in Install using DNF (RHEL 8 and later). Add
-yto eachsudo dnforsudo yumcommand that must skip confirmations. -
Disable the MySQL module when step 1 of that procedure shows an
[e]marker:sudo dnf module disable mysql -y -
Install repository and server packages:
sudo dnf install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm sudo percona-release enable-only ps-97-lts release sudo dnf install -y percona-server-serverIf your playbook uses
percona-release setupinstead ofenable-only, add-ytosetupas shown in Unattended installations. -
Start the server and enable it at boot:
sudo systemctl enable --now mysqldThe service name can be
mysqldormysqldepending on the distribution. Confirm withsystemctl status mysqldorsystemctl status mysql. -
Read the temporary password and set a permanent password. Use
caching_sha2_passwordon 9.7:TMP_PASS=$(sudo grep 'temporary password' /var/log/mysqld.log | tail -1 | awk '{print $NF}') mysql --connect-expired-password -uroot -p"${TMP_PASS}" -e \ "ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '<strong-password>';"Replace
<strong-password>with a value that meets your password policy. Do not commit real passwords to version control or shell history. For manual steps and policy errors, see Post-installation — Update the root password. -
Optional: run hardening after the password is set. The
mysql_secure_installationscript is interactive by default. For unattended hardening, apply equivalent SQL or use your configuration management tool. See Post-installation — Secure the server and Sanity check.
Default authentication plugin¶
On 9.7, native-password authentication is unavailable. Unattended installs must use caching_sha2_password and compatible clients. See Authentication methods.
See also¶
-
Telemetry: Set
PERCONA_TELEMETRY_DISABLE=1on thednforyumcommand line to disable collection -
Authentication methods:
caching_sha2_passwordand related settings -
Post-installation: Secure and configure the server after package install
-
DNF documentation — assumeyes : Global non-interactive DNF behavior
Unattended installations¶
Use the DNF sequence in Install using DNF (RHEL 8 and later). Add -y to each sudo dnf install or sudo yum install command that must skip confirmations. For percona-release setup, use the non-interactive options in the following snippet.
The -y flag confirms all actions without user input. Use the flag for unattended installations or automated scripts. The flag skips confirmation prompts. You cannot review changes before the command runs. Use the flag only when you trust the command.
Recommended syntax with percona-release setup:
percona-release setup -y ps-97-lts