Linux(Ubuntu)换apt-get源

时间:2023-03-09 16:43:54
Linux(Ubuntu)换apt-get源

在虚拟机安装完Ubuntu后,因为apt-get命令默认的服务器在国外会很慢,换成国内的会快很多

  1. 选一个国内镜像源,以清华大学开源镜像为例,要选对应的Ubuntu版本

    网站链接https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

    Linux(Ubuntu)换apt-get源

  2. 备份原来的源

    cd /etc/apt
    sudo cp sources.list sources.list.bak
  3. 可以在桌面新建sources.list,复制过去保存后退出,执行命令

    sudo mv ~/Desktop/sources.list /etc/apt/sources.list
  4. 最后更新后重启后就换好了,速度明显快多了

    sudo apt-get update
    reboot