Giunsa Pag-disable ang Mga Update sa Package Gamit ang YUM/DNF sa RHEL Linux


Ang mga distribusyon sa Linux nga nakabase sa Red Hat, nga gigamit alang sa pagkuha, pag-install, pag-upgrade, pagtangtang, ug pagpangutana nga mga pakete gikan sa opisyal nga mga repositoryo sa software ug mga repositoryo sa ikatulo nga partido.

Samtang nag-update sa sistema, usahay, dili namo i-update ang pipila ka mga pakete sama sa Apache Server (HTTP), MySQL, PHP, o bisan unsang dagkong aplikasyon, tungod kay ang pag-update sa maong software mahimong makaguba sa kasamtangan nga nagdagan nga mga aplikasyon sa web sa usa ka server ug hinungdan sa dagkong mga isyu. Girekomenda nga hunongon ang mga pag-update alang sa ingon nga software hangtod ang aplikasyon ma-patched sa mga bag-ong update.

Niini nga artikulo, ipakita namo kanimo kung giunsa namo dili iapil (dili pag-disable) ang pipila ka mga update sa package gamit ang YUM ug DNF package manager sa RPM-based distributions sama sa RHEL, CentOS, Fedora, Rocky Linux, ug AlmaLinux. Mahimo usab namon nga dili iapil o i-disable ang pipila nga mga update sa package gikan sa bisan unsang mga repository sa ikatulo nga partido.

Ang dili iapil nga syntax mao ang mosunod.

exclude=package package1 packages*

Ang naa sa ibabaw nga dili apil nga direktiba gihubit sa /etc/yum.conf o /etc/dnf/dnf.conf configuration file nga adunay lista sa mga pakete nga dili iapil sa mga update o pag-install.

Ang syntax sa ibabaw dili iapil ang package, package1, ug lista sa package nga mga update o pag-install. Ang matag keyword kinahanglan nga bulagon nga adunay luna alang sa dili paglakip sa mga pakete.

Giunsa Dili Iapil ang Mga Pakete sa YUM o DNF

Aron dili iapil (disable) ang piho nga mga update sa package, Ablihi ang file nga gitawag og /etc/yum.conf o /etc/dnf/dnf.conf sa imong gipili nga editor.

# vi /etc/yum.conf
OR
# vi /etc/dnf/dnf.conf

Idugang ang mosunud nga linya sa ilawom sa file nga dili iapil ang keyword sama sa gipakita sa ubos.

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

# This is the default, if you make this bigger yum won't see if the metadata 
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

## Exclude following Packages Updates ##
exclude=httpd php mysql

Sa pananglitan sa ibabaw, ang linya nga dili iapil mag-disable sa mga update para sa httpd php ug mysql nga mga pakete. Atong sulayan ang pag-instalar o pag-update sa usa niini gamit ang YUM command sama sa gipakita sa ubos.

# yum update httpd
OR
# dnf update httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.01link.hk
 * extras: centos.01link.hk
 * updates: mirrors.hns.net.in
base                                                   | 3.7 kB     00:00
extras                                                 | 3.0 kB     00:00
updates                                                | 3.5 kB     00:00
updates/primary_db                                     | 2.7 MB     00:16
Setting up Update Process
No Packages marked for Update

Giunsa Dili Iapil ang mga Pakete gikan sa EPEL Repo

Aron dili iapil ang mga pag-install o mga update sa package gikan sa EPEL repository, dayon ablihi ang file nga gitawag og /etc/yum.repos.d/epel.repo.

# vi /etc/yum.repos.d/epel.repo

Idugang ang dili iapil nga linya pinaagi sa pagpiho sa mga pakete nga dili iapil sa mga update.

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
## Exclude following Packages Updates ##
exclude=perl php python

Karon sulayi ang pag-update sa mga gipiho sa ibabaw nga mga file gikan sa EPEL repository gamit ang yum/dnf command sama sa gipakita.

# dnf update perl php python
OR
# yum update perl php python
Last metadata expiration check: 0:00:37 ago on Wednesday 17 November 2021 03:41:28 AM EST.
Package perl available, but not installed.
No match for argument: perl
No match for argument: php
No match for argument: python
Error: No packages marked for upgrade.

Mahimo usab nimo gamiton ang yum/dnf command-line nga kapilian aron dili iapil ang mga pakete nga dili idugang kini sa mga file sa repositoryo.

# yum --exclude=httpd update
Or
# dnf --exclude=httpd update

Aron dili iapil ang usa ka lista sa mga pakete, gamita ang mando sama sa mosunod.

# yum --exclude=mysql\* --exclude=httpd\* update
Or
# dnf --exclude=mysql\* --exclude=httpd\* update

Niining paagiha mahimo nimong dili iapil ang mga update alang sa bisan unsang mga pakete nga gusto nimo. Adunay daghang uban pang mga paagi nga mahimo nimo kini, pananglitan, bag-ohay lang nag-compile kami usa ka artikulo sa 4 nga mapuslanon nga mga paagi sa pag-block/pag-disable o pag-lock sa pipila nga mga pakete gamit ang yum command sa Linux.