Roll back and pin a package version with yum (RHEL 8)
List available versions with yum, install a specific version and lock it with the versionlock plugin on RHEL 8.
On RHEL 8, yum can list the available versions of a package, install a specific version, then lock it with the versionlock plugin so that updates do not replace it. The examples use OpenJDK 11.
To switch the active Java version on RHEL 8, see the Red Hat article Install Java on RHEL 8 and switching between versions.
List the available versions
yum --showduplicates list java-11-openjdk
yum --showduplicates list java-11-openjdk-headless.x86_64
The --showduplicates option shows every version in the repositories, not only the latest.
Install a specific version
sudo yum install java-11-openjdk-1:11.0.17.0.8-2.el8_6.x86_64
The format is name-epoch:version-release.architecture.
Lock a version
The yum-plugin-versionlock plugin prevents the locked package from being updated or removed.
sudo yum install yum-plugin-versionlock
sudo yum versionlock list
sudo yum versionlock add java-11-openjdk-1:11.0.17.0.8-2.el8_6.x86_64
sudo yum versionlock add java-11-openjdk-headless.x86_64
Remove the lock
sudo yum versionlock delete java-11-openjdk-1:11.0.17.0.8-2.el8_6