How to lock and unlock the software package version in CentOS and Redhat (yumversionlock

Source: Internet
Author: User
Sometimes, when updating the system, you do not need to upgrade some software packages. you need to lock the package to a specific version. For example, for mysql-server, to avoid unexpected update errors, the RedhatCentOS label cannot be upgraded.

So how do I lock the package in a specific version? The following describes a method. Use the yum versionlock command to lock the version.

1. install

Copy codeCode: # yum install yum-plugin-versionlock.noarch
2. add a lock package

Example: Lock the perl package to the current version

Copy codeThe 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 the lock list

Copy codeThe code is as follows: # yum versionlock list
Loaded plugins: fastestmirror, versionlock
4: perl-5.10.1-127.el6 .*
Versionlock list done
4. clear a single package lock

Copy codeThe code is as follows: # yum versionlock delete '4: perl-5.10.1-127.el6 .*'
Loaded plugins: fastestmirror, versionlock
Deleting versionlock for: 4: perl-5.10.1-127.el6 .*
Versionlock deleted: 1
5. clear all locks

Copy codeThe code is as follows: # yum versionlock clear
Loaded plugins: fastestmirror, versionlock
Versionlock cleared
6. instance

Copy codeThe code is as follows: # yum check-update perl
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
* Base: mirrors.163.com
* Epel: pai01.idc.hinet.net
* Extras: mirrors.163.com
* Updates: mirrors.163.com

Perl. x86_64. 10.1-136. el6 base

Lock current perl version

Copy codeThe 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

Copy codeThe code is as follows:
# Yum update perl
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
* Base: mirrors.163.com
* Epel: pai01.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 indicates that the lock is successful.

Remove perl lock for updates

Copy codeThe code is as follows:
# Yum versionlock delete '4: perl-5.10.1-127.el6 .*'
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.el6_5 .*
0: mysql-5.1.73-3.el6_5 .*
Versionlock list done
Update the perl package

Copy codeThe code is as follows:
# Yum update-y perl
Updated:
Perl. x86_64. 10.1-136. el6
Complete!
Perl versions before and after the upgrade

Copy codeThe 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

Use this command to avoid mistakenly upgrading the software package to the latest version. Especially for software packages in the production environment, version updates may cause some configuration parameters to be incompatible with the service to stop, thus affecting normal access.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.