更换国内源+安装docker
----------------------------------------------------------------------------------------------------
整个步骤记录
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
ls
mv CentOS7-Base-163.repo /etc/yum.repos.d/CentOS-Base.repo
运行以下命令生成缓存
yum clean all
yum makecache
----------------------------------------------------------------------------------------------------
下载对应版本 repo 文件, 放入 /etc/yum.repos.d/ (操作前请做好相应备份)
- CentOS5 :http://mirrors.163.com/.help/CentOS5-Base-163.repo
- CentOS6 :http://mirrors.163.com/.help/CentOS6-Base-163.repo
- CentOS7 :http://mirrors.163.com/.help/CentOS7-Base-163.repo
除了网易之外,国内还有其他不错的 yum 源,比如中科大和搜狐。
中科大的 yum 源,安装方法查看:https://lug.ustc.edu.cn/wiki/mirrors/help/centos
sohu 的 yum 源安装方法查看: http://mirrors.sohu.com/help/centos.html
阿里云的源:https://developer.aliyun.com/mirror/centos
----------------------------------------------------------------------------------------------------
阿里云centos安装docker
在CentOS上安装Docker,可以遵循以下步骤:
更新软件包:
sudo yum update
安装Docker依赖的包:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
设置Docker仓库:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装Docker CE (社区版):
sudo yum install docker-ce docker-ce-cli containerd.io
启动Docker服务:
sudo systemctl start docker
设置Docker开机自启:
sudo systemctl enable docker
验证Docker是否正确安装:
docker --version
安装docker
更换阿里云 docker源地址
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
报错信息
failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirrors.163.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
-------------------------------------------------------------------------------------------------------------------------------------
需要更换yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
-------------------------------------------------------------------------------------------------------------------------------------
1. 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
centos8(centos8官方源已下线,建议切换centos-vault源)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
centos6(centos6官方源已下线,建议切换centos-vault源)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3. 运行 yum makecache 生成缓存
posted on 2024-07-11 19:22 孤舟蓑笠翁独钓寒江雪 阅读(105) 评论(0) 编辑 收藏 举报