CentOS8 yumでパッケージをインストールしようとしたところエラーになってしまった

ショコラ
ショコラ

CentOS8 yumでパッケージをインストールしようとしたところエラーになってしまった

CentOS-Linux-AppStream.repo と CentOS-Linux-BaseOS.repo の2つのファイルを修正してキメマス。

もっさん先輩
もっさん先輩

手順

  1. CentOS-Linux-AppStream.repo の URL を修正します。
sed -i 's/mirrorlist=/#mirrorlist=/; s/#baseurl=http:\/\/mirror/baseurl=http:\/\/vault/'\
 /etc/yum.repos.d/CentOS-Linux-AppStream.repo
  1. CentOS-Linux-BaseOS.repo の URL を修正します。
sed -i 's/mirrorlist=/#mirrorlist=/; s/#baseurl=http:\/\/mirror/baseurl=http:\/\/vault/'\
 /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

ようするに↓でOKです。

sed -i 's/mirrorlist=/#mirrorlist=/; s/#baseurl=http:\/\/mirror/baseurl=http:\/\/vault/'\
 /etc/yum.repos.d/CentOS-Linux-AppStream.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo

以上

修正後の CentOS-Linux-AppStream.repo

# CentOS-Linux-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.

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

修正後の CentOS-Linux-BaseOS.repo

# CentOS-Linux-BaseOS.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.

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

シチュエーション

CentOS8 で yum でパッケージをインストールしようとしたところエラーになってしまった。

# yum install make
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream  59  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
# yum install make
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream 9.0 MB/s | 8.4 MB     00:00
CentOS Linux 8 - BaseOS     71  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'baseos': Cannot prepare internal mirrorlist: No URLs in mirrorlist
Scroll to Top