본문 바로가기

리눅스

[draft] CentOS 8 미러 서버용 repo(CentOS-Base.repo) 파일

CentOS 8 미러 서버용 repo(CentOS-Base.repo) 파일

CentOS 8은 2021년 12월부로 공식 지원(EOL) 이 종료되었습니다.

따라서 기본 미러 서버(mirror.centos.org)는 더 이상 패키지를 제공하지 않으며, vault.centos.org 저장소를 통해 과거 패키지 버전에 접근해야 합니다.

 

CentOS-Base.repo 편집

vim /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[BaseOS]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
baseurl=https://vault.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

CentOS-AppStream.repo 편집

vim /etc/yum.repos.d/CentOS-AppStream.repo
# CentOS-AppStream.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[AppStream]
name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
baseurl=https://vault.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

파일을 저장한 후 yum을 업데이트하면 CentOS 8 미러 서버에서 패키지를 다운로드할 수 있습니다.

sed 명령어를 사용하여 편집하기

mirrorlist 비활성화

sed -i -E 's/^(#mirrorlist)/mirrorlist/g' /etc/yum.repos.d/CentOS-*

baseurl을 vault.centos.org로 변경

sed -i 's|#baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

YUM 업데이트 테스트

sudo yum clean all
sudo yum makecache