apt更改为国内源

由于linux默认apt源为国外源,网速太慢,所以不建议使用默认apt源,建议使用过内源。

备份原文件:sudo cp /etc/apt/sources.list /etc/apt/sources.list.buckup

编辑原文件:sudo gedit /etc/apt/sources.list

国内源可以换成清华的,文件里保存的具体内容可以访问链接https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/,根据Linux版本选择对应的文件内容,


如版本选择的是Ubuntu18.04 LTS,内容如下

# 默认注释了源码镜像以提高 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

你可能感兴趣的:(apt更改为国内源)