RHEL Linux에서 YUM/DNF를 사용하여 패키지 업데이트를 비활성화하는 방법
공식 소프트웨어 리포지토리 및 타사 리포지토리에서 패키지를 가져오고, 설치하고, 업그레이드하고, 제거하고, 쿼리하는 데 사용되는 Red Hat 기반 Linux 배포판입니다.
시스템을 업데이트하는 동안 Apache Server(HTTP), MySQL, PHP 또는 기타 주요 응용 프로그램과 같은 특정 패키지를 업데이트하지 않는 경우가 있습니다. 이러한 소프트웨어를 업데이트하면 서버에서 현재 실행 중인 웹 응용 프로그램이 중단되고 주요 문제가 발생할 수 있기 때문입니다. 응용 프로그램이 새 업데이트로 패치될 때까지 이러한 소프트웨어에 대한 업데이트를 중지하는 것이 좋습니다.
이 기사에서는 RHEL, CentOS, Fedora, Rocky Linux 및 AlmaLinux와 같은 RPM 기반 배포에서 YUM 및 DNF 패키지 관리자를 사용하여 특정 패키지 업데이트를 제외(비활성화)하는 방법을 보여줍니다. 또한 타사 리포지토리에서 특정 패키지 업데이트를 제외하거나 비활성화할 수 있습니다.
제외 구문은 다음과 같습니다.
exclude=package package1 packages*
위의 제외 지시문은 업데이트 또는 설치에서 제외할 패키지 목록과 함께 /etc/yum.conf 또는 /etc/dnf/dnf.conf 구성 파일에 정의되어 있습니다.
위의 구문은 \"패키지\", \"패키지1\" 및 \"패키지\" 업데이트 또는 설치 목록을 제외합니다. 각 키워드는 패키지 제외를 위한 공백으로 구분되어야 합니다.
YUM 또는 DNF에서 패키지를 제외하는 방법
특정 패키지 업데이트를 제외(비활성화)하려면 선택한 편집기로 /etc/yum.conf 또는 /etc/dnf/dnf.conf 파일을 엽니다.
# vi /etc/yum.conf OR # vi /etc/dnf/dnf.conf
아래와 같이 exclude 키워드를 사용하여 파일 하단에 다음 줄을 추가합니다.
[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
위의 예에서 exclude 행은 \"httpd\" \"php\" 및 \"mysql\" 패키지에 대한 업데이트를 비활성화합니다. 아래와 같이 YUM 명령을 사용하여 그 중 하나를 설치하거나 업데이트해 보겠습니다.
# 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
EPEL Repo에서 패키지를 제외하는 방법
EPEL 저장소에서 패키지 설치 또는 업데이트를 제외하려면 /etc/yum.repos.d/epel.repo라는 파일을 엽니다.
# vi /etc/yum.repos.d/epel.repo
업데이트에서 제외할 패키지를 지정하여 제외 라인을 추가합니다.
[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
이제 표시된 대로 yum/dnf 명령을 사용하여 EPEL 저장소에서 위에 지정된 파일을 업데이트하십시오.
# 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.
yum/dnf 명령줄 옵션을 사용하여 저장소 파일에 패키지를 추가하지 않고 제외할 수도 있습니다.
# yum --exclude=httpd update Or # dnf --exclude=httpd update
패키지 목록을 제외하려면 다음과 같이 명령을 사용합니다.
# yum --exclude=mysql\* --exclude=httpd\* update Or # dnf --exclude=mysql\* --exclude=httpd\* update
이렇게 하면 원하는 패키지에 대한 업데이트를 제외할 수 있습니다. 다른 많은 방법이 있습니다. 예를 들어 최근에 Linux에서 yum 명령을 사용하여 특정 패키지를 차단/비활성화 또는 잠그는 4가지 유용한 방법에 대한 기사를 작성했습니다.