美文网首页
linux apt-get 设置国内镜像

linux apt-get 设置国内镜像

作者: Assassin_1397 | 来源:发表于2020-09-20 21:55 被阅读0次

    清华源地址

    https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

    image-20200920211725535

    在桌面新建tsinghua.list

    cd ~/Desktop
    touch tsinghua.list
    sudo ln -s /home/{your name}/Desktop/tsinghua.list /etc/apt/sources.list.d/tsinghua.list
    

    tsinghua.list内容

    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-updates main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-updates main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-backports main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-backports main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-security main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-security main restricted universe multiverse
    
    # 预发布软件源,不建议启用
    # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-proposed main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ groovy-proposed main restricted universe multiverse
    

    执行更新

    apt-get update
    

    可能会报如下错误:

    image-20200920213146896

    这里需要执行以下命令

    echo "sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \$1" > add_apt_key.sh
    chmod +x add_apt_key.sh
    ./add_apt_key.sh 871920D1991BC93C
    

    重新执行更新就正常了

    apt-get update
    

    相关文章

      网友评论

          本文标题:linux apt-get 设置国内镜像

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