본문 바로가기

리눅스

CentOS 7에서 yum update를 실행할 때 kernel 패키지를 제외하는 방법

728x90

CentOS 7에서 yum update를 실행할 때 kernel 패키지를 제외하는 방법

CentOS 7에서 yum update를 실행할 때 특정 패키지, 예를 들어 커널 패키지를 제외하려면 exclude 설정을 사용할 수 있습니다. exclude 설정을 통해 특정 패키지를 업데이트에서 제외시킬 수 있습니다.

 

다음은 yum.conf 파일을 편집하여 커널 패키지를 업데이트에서 제외하는 방법입니다.

 

1. 편집기를 사용하여 yum.conf 파일을 엽니다.

vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
###업데이트 시 kernel 이 포함된 패키지 제외
exclude=kernel*
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
distroverpkg=system-release
timeout=5
retries=7


#  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

 

2. 파일 내에서 [main] 섹션을 찾습니다.

 

3. [main] 섹션 아래에 다음과 같이 exclude 옵션을 추가합니다.

exclude=kernel*

위의 예시에서는 kernel으로 시작하는 모든 패키지를 제외합니다.

 

4. 파일을 저장하고 종료합니다. (vi 에디터에서는 :wq를 입력하여 저장하고 종료할 수 있습니다.)

 

이제 yum update를 실행할 때 커널 패키지가 업데이트 대상에서 제외됩니다. 다른 패키지는 정상적으로 업데이트됩니다.

 

728x90