更换树莓派版本的Ubuntu server20.04镜像源

2023-07-01 15:02:05 浏览数 (2)

环境说明: 设备:树莓派4B 操作系统:ubuntu server20.04

树莓派4B安装的ubuntu要用的是ubuntu-ports的源,而不是原ubuntu的源,若使用错误的源,则在更新时会报错误。

1. 首先备份源文件:

代码语言:javascript复制
sudo cp /etc/apt/sources.list /etc/apt/sources.listbak

当然备份这一步是可选的,我一般不会备份(因为懒),在修改源文件时注释掉原来的源信息,有问题时去掉注释即可恢复回来

2. 用nano编辑 /etc/apt/sources.list

代码语言:javascript复制
sudo nano /etc/apt/sources.list

下面的内容包含了科大的源和阿里云的源,任选一个粘贴到刚打开的文件中,原文件中的内容可以选择注释掉或者删除

代码语言:javascript复制
# 科大的源:
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal main main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse

# 阿里云的源:
deb http://mirrors.aliyun.com/ubuntu-ports focal main restricted
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates main restricted
deb http://mirrors.aliyun.com/ubuntu-ports focal universe
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates universe
deb http://mirrors.aliyun.com/ubuntu-ports focal multiverse
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates multiverse
deb http://mirrors.aliyun.com/ubuntu-ports focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu-ports focal-security universe
deb http://mirrors.aliyun.com/ubuntu-ports focal-security multiverse

然后ctrl o保存,ctrl x退出

2. 更新源即可:

代码语言:javascript复制
sudo apt update
sudo apt upgrade

附科大源链接:http://mirrors.ustc.edu.cn/help/ubuntu-ports.html

0 人点赞