armbian环境下更换国内镜像源

avatar
作者
猴君
阅读量: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 

一般对应关系是

关键字版本
jammyUbuntu 22.04 LTS
lunarUbuntu 23.04
kineticUbuntu 22.10
focalUbuntu 20.04 LTS
bionicUbuntu 18.04 LTS
xenialUbuntu 16.04 LTS
trustyUbuntu 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更新源

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!