← 返回命令列表

Linux command

yum-versionlock 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Lock a package

sudo yum versionlock add [package_name]

List all locked packages

yum versionlock list

Remove a lock

sudo yum versionlock delete [package_name]

Clear all version locks

sudo yum versionlock clear

Lock a package to a specific version

sudo yum versionlock add [package_name]-[version]-[release]

Exclude packages matching a pattern

sudo yum versionlock exclude [package_pattern*]

Show status

yum versionlock status

说明

yum-versionlock is a yum plugin that allows administrators to lock specific packages to their currently installed versions, preventing them from being updated during system upgrades. This is useful for maintaining stability when newer package versions might break compatibility or when specific versions are required for compliance. When a package is locked, yum will skip it during yum update operations, even if newer versions are available in configured repositories. The lock persists across reboots and update sessions until explicitly removed. Locked packages are stored in /etc/yum/pluginconf.d/versionlock.list (or similar path depending on the distribution). Each entry follows the NEVRA format: name-epoch:version-release.arch. The plugin must be installed separately via yum install yum-plugin-versionlock (RHEL/CentOS 7) or dnf install python3-dnf-plugin-versionlock (Fedora/RHEL 8+). On newer systems using DNF, the command syntax is dnf versionlock.

参数

add _package_
Lock the specified package(s) to their currently installed versions. Prevents yum from updating these packages.
list
Display all currently locked packages and their versions.
delete _package_
Remove the version lock from the specified package(s), allowing them to be updated again.
clear
Remove all version locks from the system.
exclude _package_
Disallow currently available versions of the packages matching the given wildcards.
status
List any available updates that are currently blocked by versionlock.

FAQ

What is the yum-versionlock command used for?

yum-versionlock is a yum plugin that allows administrators to lock specific packages to their currently installed versions, preventing them from being updated during system upgrades. This is useful for maintaining stability when newer package versions might break compatibility or when specific versions are required for compliance. When a package is locked, yum will skip it during yum update operations, even if newer versions are available in configured repositories. The lock persists across reboots and update sessions until explicitly removed. Locked packages are stored in /etc/yum/pluginconf.d/versionlock.list (or similar path depending on the distribution). Each entry follows the NEVRA format: name-epoch:version-release.arch. The plugin must be installed separately via yum install yum-plugin-versionlock (RHEL/CentOS 7) or dnf install python3-dnf-plugin-versionlock (Fedora/RHEL 8+). On newer systems using DNF, the command syntax is dnf versionlock.

How do I run a basic yum-versionlock example?

Run `sudo yum versionlock add [package_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does add _package_ do in yum-versionlock?

Lock the specified package(s) to their currently installed versions. Prevents yum from updating these packages.