今天在安装docker 镜像和容器,发现国外的yum源没办法更新,然后尝试更换aliyun 源,结果出现了几个大坑,在此记录,希望后续的兄弟们别掉坑里。
首先修改 CentOS-base.repo , root 下执行 vim 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.##[base]name=CentOS-8.5.2111 - base - mirrors.aliyun.combaseurl=http://mirrors.cloud.tencent.com/centos/$releasever/baseOS/$basearch/os/gpgcheck=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official#additional packages that may be useful[extras]name=CentOS-8.5.2111 - Extras - mirrors.aliyun.combaseurl=http://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os/gpgcheck=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official#additional packages that extend functionality of existing packages[centosplus]name=CentOS-8.5.2111 - Plus - mirrors.aliyun.combaseurl=http://mirrors.cloud.tencent.com/centos/$releasever/centosplus/$basearch/os/gpgcheck=0enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official[PowerTools]name=CentOS-8.5.2111 - PowerTools - mirrors.aliyun.combaseurl=http://mirrors.cloud.tencent.com/centos/$releasever/PowerTools/$basearch/os/gpgcheck=0enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official[AppStream]name=CentOS-8.5.2111 - AppStream - mirrors.aliyun.combaseurl=http://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/gpgcheck=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
这里需要注意,网络流传版本的结果方法其他地方都没有问题,但是就这个节点:[AppStream]
路径要注意,不能用 releasever 来通配版本号,事实上我发现阿里云的源这里已经换成了 8-stream
正确的应该是 baseurl=http://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/
然后继续修改 CentOS-AppStream.repo root 下执行命令 vim 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 - AppStreambaseurl=http://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/gpgcheck=0enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
这里也一样,
正确的应该是 baseurl=http://mirrors.aliyun.com/centos/8-stream/AppStream/$basearch/os/
然后 yum clean all yum makecache 重建元数据缓存,此时就可以看到docker 的更新源文件了。