给centos重新安装yum的base-repo源

第一步:替换源

方式一:使用国内的阿里云镜像
把/etc/yum.repos.d/下面所有的源给删除掉了
下载镜像

centos 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

centos 6

wget -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

方式二:使用官网的镜像
(1)把/etc/yum.repos.d/下面所有的源给删除掉了
(2)执行下面的命令,重新生成镜像
//执行这个命令之后
rpm -Uvh --force http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-4.1708.el7.centos.x86_64.rpm

第二步:更新yum

rpm -e rpmforge-release --nodeps
yum clean all
yum update

第三步:执行yum install

如出现:如下错误
Loaded plugins: fastestmirror, refresh-packagekit, security
执行以下操作:
vi /etc/yum/pluginconf.d/fastestmirror.conf
把enabled=1改为0
vi /etc/yum.conf
把plugins=1改为0
yum>sed -i “s/plugins=1/plugins=0” /etc/yum.conf
yum clean all

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值