美文网首页
Centos7配置yum源

Centos7配置yum源

作者: 半理想主义 | 来源:发表于2023-04-04 20:36 被阅读0次

    1、查看当前yum源

    sudo yum repolist
    

    2、备份原始yum源

    cd   /etc/yum.repos.d
    cp  CentOS-Base.repo   CentOS-Base.repo-20220705.bak
    

    3、配置CentOS的DNS:

    vim   /etc/resolv.conf
    nameserver   114.114.114.114      //国内dns
    nameserver   8.8.8.8              //国外dns
    

    4、下载yum文件,替代原始yum源:

    (1)网易yum源:
                wget -O /etc/yum.repos.d/CentOS-Base.repo    http://mirrors.163.com/.help/CentOS7-Base-163.repo
                yum clean all          //清除缓存
                yum   makecache       //生成缓存
                解析:wget -o,使用“-o”参数来指定一个文件名
    
    (2)阿里云yum源:
                wget   -O   /etc/yum.repos.d/CentOS-Base.repo    http://mirrors.aliyun.com/repo/Centos-7.repo
                yum   clean  all
                yum   makecache
    

    此处可作为参考

    https://developer.aliyun.com/mirror/

    image.png

    相关文章

      网友评论

          本文标题:Centos7配置yum源

          本文链接:https://www.haomeiwen.com/subject/drisddtx.html