Ubuntu更换源

Ubuntu更换源

Ubuntu默认的镜像都部署在国外,下载速度慢,可以更换成国内的镜像提高下载速度

清华大学镜像源 https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
选择相应的版本,按照页面的提示去做即可
即将/etc/apt/source.list文件的内容替换如下

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

具体命令

linux@ubuntu:~$ cd /etc/apt
linux@ubuntu:/etc/apt$ sudo cp sources.list sources.list.bak  #备份一下
linux@ubuntu:/etc/apt$ sudo vim sources.list  #修改替换为页面上复制的内容
linux@ubuntu:/etc/apt$ sudo apt-get update    #更新

完成

参考:https://www.linuxidc.com/Linux/2017-11/148627.htm

你可能感兴趣的:(linux)