一、软件的镜像网址
1. 设置阿里镜像
阿里云镜像网址:https://developer.aliyun.com/mirror/
点击对应系统,按照步骤配置即可。
具体操作,有网环境:
- 安装wget
yum -y install wget
- 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS 8
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo`
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
- 清理缓存
yum clean all
- 重新生成缓存
yum makecache
2. 设置网易镜像
镜像设置参考地址:http://mirrors.163.com/.help/centos.html
网易提供的是配置文件,有网直接使用wget下载对用的配置文件到对应的目录即可。
后续操作跟阿里云一致。
截止目前网易只有5,6,7的镜像配置。
3. 设置清华大学开源软件镜像
镜像设置参考地址:https://mirrors.tuna.tsinghua.edu.cn/help/centos/
- 备份
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
- 更改配置
编辑 /etc/yum.repos.d/CentOS-Base.repo 文件,在 mirrorlist= 开头行前面加 # 注释掉;并将 baseurl= 开头行取消注释(如果被注释的话),把该行内的域名(例如mirror.centos.org)替换为 mirrors.tuna.tsinghua.edu.cn。
或者获取对应版本的配置进行覆盖,但是最好不要,官方都说未经过充分测试。 - 清空缓存,重新生成即可。
4. 设置中国科大软件镜像
镜像设置参考地址:https://mirrors.ustc.edu.cn/help/centos.html
- 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载对应版本的 CentOS-Base.repo , 放入 /etc/yum.repos.d/
- 清空缓存,重新生成即可。