Docker配置CentOS8源(阿里源)

Docker配置CentOS8源(阿里源)

可直接保存到有道云:跳转到有道云笔记

备份原有配置

mkdir /etc/yum.repos.d.bak
mv /etc/yum.repos.d/* /etc/yum.repos.d.bak/
ll /etc/yum.repos.d/
ll /etc/yum.repos.d.bak/

下载阿里云镜像配置

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo

修改配置文件
删除"mirrors.cloud.aliyuncs.com" 及 “mirrors.aliyuncs.com” 字符串所在的行

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

替换 “releasever/” 为 “releasever-stream/”

sed -i 's/releasever\//releasever-stream\//g' /etc/yum.repos.d/CentOS-Base.repo

重置缓存

yum clean all 
yum makecache

测试是否成功

yum -y install dos2unix

你可能感兴趣的:(Docker,docker,运维,容器,centos)