Ubuntu 更换国内源

查看系统版本

lsb_release -c

> Codename:       focal  #focal 说明是ubuntu20.04

ubuntu版本名与系统名对应关系,使用错误的版本源会导致依赖缺失和版本不对。

系统名    版本名
ubuntu20.04    focal
ubuntu18.04    bionic
ubuntu16.04    xenial
ubuntu14.04    trusty

首先备份原来的源

进入root用户
su

mv /etc/apt/sources.list /etc/apt/sources.list.bak

或 cp /etc/apt/sources.list /etc/apt/sources.list.bak

再输入以下命令打开sources.list配置文件更换源,以Ubuntu20.04为例。

sudo vim /etc/apt/sources.list
​
#配置内容如下-阿里源 Ubuntu20.04
​
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

#更新源

sudo apt-get update

再重新下载安装速度就很快啦。

ubuntu默认的下载源是国外地址,国内下载非常慢。

ubuntu下载源定义在 /etc/apt/sources.list 文件中,通过将下载源替换为阿里源,随后运行sudo apt-get update重新加载下载源,之后下载都默认从阿里云下载了,速度就非常快。


源地址查看:

阿里

https://developer.aliyun.com/mirror/ubuntu/?spm=a2c6h.25603864.0.0.5f0d28b9BeBlwE

清华

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

网易

http://mirrors.163.com/.help/ubuntu.html


ISO下载地址:

官方

https://ubuntu.com/download
http://old-releases.ubuntu.com/releases/

阿里

https://mirrors.aliyun.com/ubuntu-releases/
https://mirrors.aliyun.com/oldubuntu-releases/releases/

清华

https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/

网易

http://mirrors.163.com/ubuntu-releases/


最后修改:2022 年 09 月 05 日
如果觉得我的文章对你有用,请随意赞赏