問題描述:Failed to download metadata for repo ‘a(chǎn)ppstream‘: Cannot prepare internal mirrorlist:...
打算在centos上運(yùn)行一個(gè)centos8的docker,因?yàn)?版官方不再支持,因此需要更換源。
找了很多方案,如解決方案寫入到DockerFIle中、wget更新等都沒解決。
最后通過以下方案解決了。
首先備份當(dāng)前的yum倉(cāng)庫(kù)配置:
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/
選擇一個(gè)合適的第三方源,比如阿里云、網(wǎng)易等。以下以阿里云為例:
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
清除緩存并生成新的緩存:
yum clean all
yum makecache
安裝wget:
yum install wget -y
結(jié)果:
Userid : "CentOS (CentOS Official Signing Key) <security@centos.org>"
Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
From : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : publicsuffix-list-dafsa-20180723-1.el8.noarch 1/3
Installing : libpsl-0.20.2-6.el8.x86_64 2/3
Installing : wget-1.19.5-10.el8.x86_64 3/3
Running scriptlet: wget-1.19.5-10.el8.x86_64 3/3
Verifying : libpsl-0.20.2-6.el8.x86_64 1/3
Verifying : publicsuffix-list-dafsa-20180723-1.el8.noarch 2/3
Verifying : wget-1.19.5-10.el8.x86_64 3/3
Installed:
libpsl-0.20.2-6.el8.x86_64 publicsuffix-list-dafsa-20180723-1.el8.noarch wget-1.19.5-10.el8.x86_64
Complete!