测试帮日记-小强测试品牌旗下

centos6修改yum源的方法

2019-04-07 20:42:00    测试帮日记    1699    原创

点击链接加入QQ群229390571(免费公开课、视频应有尽有):https://jq.qq.com/?_wv=1027&k=5rbudQa


个别同学在yum安装软件的时候提示找不到源地址无法执行成功。一般是由于自己网络本身限制导致,解决方法为修改yum源为国内的。


#备份当前的yum源
mv /etc/yum.repos.d /etc/yum.repos.d.backup4comex
#新建空的yum源设置目录
mkdir /etc/yum.repos.d
#下载阿里云的yum源配置
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
#重建缓存

yum clean all
yum makecache


可能遇到的问题:执行报错“-bash: wget: command not found”

#回滚配置

cp /etc/yum.repos.d.backup4comex/* /etc/yum.repos.d

#安装wget


yum install wget -y


rm -rf /etc/yum.repos.d
mkdir /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo