zoukankan      html  css  js  c++  java
  • Linux修改资源为阿里云镜像

    Ubuntu系统


    将下列文本添加到/etc/apt/sources.list文件里

    deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    但是执行sudo apt-get update仍然报错,问题在于DNS没有配置好。
    解决方法:

    sudo vi /etc/resolv.conf
    1
    添加

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.1.1
    #这里用的是阿里云的DNS服务器
    nameserver 223.5.5.5
    nameserver 223.6.6.6
    1
    2
    3
    4
    5
    6
    之后执行sudo apt-get update就正常了。

    Centos系统

    修改步骤:

    1、备份

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

    2、下载新的CentOS-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

    或者

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

    或者

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

    或者

    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

    CentOS 8
     
    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo


    3、清除缓存
     
    yum clean all
     

    4、之后运行yum makecache生成缓存

  • 相关阅读:
    定理环境
    tcolorbox 宏包简明教程
    【专访】南科大数学系何炳生教授——四十年上下求索
    研究生导师为什么喜欢问学生家境?
    高德纳谈《具体数学》的诞生
    剑桥大学
    线性代数
    APPCAN的mas服务报错
    github删除仓库
    Angular2入门教程-2 实现TodoList App
  • 原文地址:https://www.cnblogs.com/rh-fernando/p/11772907.html
Copyright © 2011-2022 走看看