CentOS7切换阿里 yum 源

x33g5p2x  于2021-09-18 转载在 其他  
字(0.7k)|赞(0)|评价(0)|浏览(365)

备份本机软件源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载新的CentOS-Base.repo 到/etc/yum.repos.d/

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

网易163:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

清除缓存

yum clean all

生成缓存

yum makecache

常见问题

CentOS中wget命令不能用怎么办?

在这里插入图片描述

CentOS中wget命令不能使用是因为没有安装,只需要安装一下即可。

1、查看是否安装:

rpm -qa|grep "wget"

2、安装wget

yum -y install wget

在这里插入图片描述

3、再次查看是否安装(出现以下版本信息表示安装成功)

在这里插入图片描述

4、输入wget -h进行测试

在这里插入图片描述

相关文章