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


    转自:https://blog.csdn.net/lovemysea/article/details/79552952

    如果自己的centos的系统yum源出现问题了,如何才能修复?

    方式一:使用国内的阿里云镜像

    (1)把/etc/yum.repos.d/下面所有的源给删除掉了

    (2)下载镜像

    # 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

    注意如果没有安装wget,可以从下面的网址中先手动下载,然后上传到linux上安装:http://www.rpmfind.net/linux/rpm2html/search.php?query=wget

    (3)执行命令,重新生成cache

    yum clean all
    yum makecache

    方式二:使用官网的镜像

    (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

    (3)查看/etc/yum.repos.d/下面目录,就会发现镜像已经安装完毕:

    -rw-r--r--. 1 root root 1664 8月  30 23:53 CentOS-Base.repo
    -rw-r--r--. 1 root root 1309 8月  30 23:53 CentOS-CR.repo
    -rw-r--r--. 1 root root  649 8月  30 23:53 CentOS-Debuginfo.repo
    -rw-r--r--. 1 root root  314 8月  30 23:53 CentOS-fasttrack.repo
    -rw-r--r--. 1 root root  630 8月  30 23:53 CentOS-Media.repo
    -rw-r--r--. 1 root root 1331 8月  30 23:53 CentOS-Sources.repo
    -rw-r--r--. 1 root root 3830 8月  30 23:53 CentOS-Vault.repo

    (4)生成缓存

    yum clean all
    yum makecache

    必要时可以执行yum update更新当前系统的安装包为新的

    手动下载命令,例子:

    #安装vim组件
    yum install -y vim
    
    #卸载vim组件
    yum remove vim

    注意第二种例子,如果不能访问国外的官网,或者访问比较慢超时了,就会导致安装失败,这时候可以使用第一种方式进行安装。

  • 相关阅读:
    老王python博客
    python中文分词
    python 字典(dict)get方法应用
    python yield和generators(生成器)
    python ASCII返回对应的值(chr)
    python 字符串特点
    python 包的定义,结构,导入过程
    fabric的安装和配置
    python 正则表达式re findall
    python unittest单元测试方法和用例
  • 原文地址:https://www.cnblogs.com/sharpest/p/8384768.html
Copyright © 2020-2023  润新知