阅读量:1
由于某些原因,我们直接访问系统默认的ubuntu源会出现访问失败或速度贼慢的情况,故为了获得更好的体验,需要更换国内镜像源。
系统默认的软件源在 /etc/apt文件夹的sources.list文件中。
查看sources.list可以看到内容一般为(如果和我的列出的有区别只是咱们用的ubuntu版本有差异)
deb http://ports.ubuntu.com/ jammy main restricted universe multiverse #deb-src http://ports.ubuntu.com/ jammy main restricted universe multiverse deb http://ports.ubuntu.com/ jammy-security main restricted universe multiverse #deb-src http://ports.ubuntu.com/ jammy-security main restricted universe multiverse deb http://ports.ubuntu.com/ jammy-updates main restricted universe multiverse #deb-src http://ports.ubuntu.com/ jammy-updates main restricted universe multiverse deb http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse #deb-src http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse
一般对应关系是
关键字 | 版本 |
---|---|
jammy | Ubuntu 22.04 LTS |
lunar | Ubuntu 23.04 |
kinetic | Ubuntu 22.10 |
focal | Ubuntu 20.04 LTS |
bionic | Ubuntu 18.04 LTS |
xenial | Ubuntu 16.04 LTS |
trusty | Ubuntu 14.04 LTS |
详细内容可以查看:清华大学开源软件镜像站
安全起见,我们先保存系统默认源文件,操作如下(将现有源文件存储为sources.list.back):
mv /etc/apt/sources.list /etc/apt/sources.list.back
然后根据关键字,选择对应的版本重新创建sources.list并写入对应内容后保存。例如:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse # deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-proposed main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy-proposed main restricted universe multiverse
至此我们已经将Ubuntu的软件源修改完成,我们还需要Armbin的软件源,该文件的位置在/etc/apt/sources.list.d
可以使用命令快捷修改为清华源:
sed -i.bak 's#http://apt.armbian.com#https://mirrors.tuna.tsinghua.edu.cn/armbian#g' /etc/apt/sources.list.d/armbian.list
修改完成后使用apt update更新源