美文网首页
Linux替换软件源为阿里云

Linux替换软件源为阿里云

作者: 雨而已 | 来源:发表于2021-02-02 15:12 被阅读0次

    Centos 7

    在系统中输入以下命令

    cd /etc/yum.repos.d/
    
    wget http://mirrors.aliyun.com/repo/Centos-7.repo
    
    mv Centos-7.repo CentOS-Base.repo
    
    yum update -y
    

    ubuntu

    修改 /etc/apt/sources.list为如下内容:

    # $Codename 需要替换为具体的版本名称
    deb http://mirrors.aliyun.com/ubuntu/ $Codename main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main restricted universe multiverse
    

    $Codename 的具体值可以通过 lsb_release -a命令查看

    lsb_release -a

    替换文件后运行 sudo apt-get update 即可完成软件源替换。

    相关文章

      网友评论

          本文标题:Linux替换软件源为阿里云

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