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

  • 相关阅读:
    【java】一种自动生成数据库文档的方法
    sublime vintage mode 按住一个键(比如 j)不会重复的问题
    SQL Service服务更换帐户后无法启动的情况(Security 4625 Type 5)
    隐藏的计划任务运行,导致账户被锁的调查方法
    nodejs 热更新页面
    数组转tree arrToTree
    compose函数
    react 类组件的生命周期
    qiankun 微应用demo
    application 'xxx' died in status LOADING_SOURCE_CODE: [qiankun] You need to export lifecycle functions in xxx entry
  • 原文地址:https://www.cnblogs.com/rh-fernando/p/11772907.html
Copyright © 2011-2022 走看看