Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to lock and unlock package versions in CentOS and Redhat and how to use yum versionlock

Shulou Source: shulou.com Published: 2022-06-01 07:18:33 10月03日 Update

This article is about CentOS and Redhat to lock and unlock the software package version of the method and the use of yum versionlock is how, the editor feels very practical, so share with you to learn, I hope you can get something after reading this article, say no more, follow the editor to have a look.

So how do you lock the package under a specific version? Now let me introduce a method. Use the yum versionlock command to lock the version.

1. Installation

The code is as follows:

# yum install yum-plugin-versionlock.noarch

two。 Add locked package

Example: lock the perl package to the current version

The code is as follows:

# yum versionlock perl

Loaded plugins: fastestmirror, versionlock

Adding versionlock on: 4:perl-5.10.1-127.el6

Versionlock added: 1

3. View lock list

The code is as follows:

# yum versionlock list

Loaded plugins: fastestmirror, versionlock

4:perl-5.10.1-127.el6.*

Versionlock list done

4. Clear single package lock

The code is as follows:

# yum versionlock delete '4:perl-5.10.1-127.el6.room'

Loaded plugins: fastestmirror, versionlock

Deleting versionlock for: 4:perl-5.10.1-127.el6.*

Versionlock deleted: 1

5. Clear all locks

The code is as follows:

# yum versionlock clear

Loaded plugins: fastestmirror, versionlock

Versionlock cleared

6. Example

The code is as follows:

# yum check-update perl

Loaded plugins: fastestmirror, versionlock

Loading mirror speeds from cached hostfile

* base: mirrors.163.com

* epel: mirror01.idc.hinet.net

* extras: mirrors.163.com

* updates: mirrors.163.com

Perl.x86_64 4VR 5.10.1-136.el6 base

Lock the current version of perl

The code is as follows:

# yum versionlock perl

Loaded plugins: fastestmirror, versionlock

Adding versionlock on: 4:perl-5.10.1-127.el6

Versionlock added: 1

Update perl version

The code is as follows:

# yum update perl

Loaded plugins: fastestmirror, versionlock

Loading mirror speeds from cached hostfile

* base: mirrors.163.com

* epel: mirror01.idc.hinet.net

* extras: mirrors.163.com

* updates: mirrors.163.com

Setting up Update Process

No Packages marked for Update

No Packages marked for Update visible lock succeeded.

Unlock perl for update

The code is as follows:

# yum versionlock delete '4:perl-5.10.1-127.el6.room'

Loaded plugins: fastestmirror, versionlock

Deleting versionlock for: 4:perl-5.10.1-127.el6.*

Versionlock deleted: 1

# yum versionlock list

Loaded plugins: fastestmirror, versionlock

0:mysql-server-5.1.73-3.el6mm 5.*

0:mysql-5.1.73-3.el6mm 5.*

Versionlock list done

Update the perl package

The code is as follows:

# yum update-y perl

Updated:

Perl.x86_64 4VR 5.10.1-136.el6

Complete!

Perl version before and after update

The code is as follows:

[root@AY14040211382766189cZ]

# rpm-qa | grep perl

Perl-5.10.1-127.el6.x86_64

[root@AY14040211382766189cZ]

# rpm-qa | grep perl

Perl-5.10.1-136.el6.x86_64

Using this directive, you can avoid mistakenly upgrading the package to the latest version. Especially in the software package in the production environment, the update of the version can have some configuration parameters that are not compatible with the service stop, thus affecting normal access.

These are the methods of locking and unlocking software package versions in CentOS and Redhat, as well as the use of yum versionlock. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Code version update software software package method more knowledge article utility success example single parameter command instance that is work meeting instruction article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Xiaomi macOS Huawei MySQL