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生成缓存

  • 相关阅读:
    HDU 2098 分拆素数和 数论
    CodeForces The Endless River
    CodeForces Good Words
    CodeForces A or B Equals C
    HDU 1251 统计难题 字典树/STL
    CSUOJ 1555 Inversion Sequence 线段树/STL
    OpenJudge P4979 海贼王之伟大航路 DFS
    敌兵布阵 线段树
    HDU 4004 The Frog's Games 二分
    HDU 2578 Dating with girls(1) 二分
  • 原文地址:https://www.cnblogs.com/rh-fernando/p/11772907.html
Copyright © 2011-2022 走看看