直接回答:换源要注意架构和发行版代号必须匹配:64 位系统要用 arm64 的源、代号要和系统版本一致,写错会出现一堆 404,改完先 apt update 看是否还报错。

1
2
sudo nano /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
1
2
sudo nano /etc/apt/sources.list.d/raspi.list
deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ stretch main ui

上面两个都要操作

64位操作系统的换源

2、换成国内源(亲测是可以支持beta版的源): 把/etc/apt/sources.list所有内容替换为:

1
2
3
4
5
6
7
deb http://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free
# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
#deb-src http://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free
#deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free
#deb-src http://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free

然后在把/etc/apt/sources.list.d/raspi.list所有内容替换为:

1
2
3
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

4.更新

1
2
sudo apt-get update
sudo apt-get upgrade

更新流程

首先通过更新存储库软件包列表:

1
sudo apt update

完成后,运行升级命令:

1
sudo apt dist-upgrade

按照所有提示进行操作,然后等待Pi升级。完成后,键入:

1
sudo apt clean

,这将丢弃升级过程中已下载的所有不需要的文件。重新启动完成:

1
sudo reboot

Raspberry Pi重新启动后,您将使用最新版本的Raspbian。做得好!

如何将Raspbian下载并安装到SD卡

虽然更新非常简单,但是您可能已经使用了足够多的Raspbian旧版本。也许它已挂起,或者SD卡已损坏,或者您正在使用其他SD卡。

无论哪种方式,您都需要安装Raspbian的最新版本。

树莓派的vi/vim编辑器

首先删除默认vi编辑器

1
sudo apt-get remove vim-common

然后重装vim

1
sudo apt-get install vim

为方便使用还得在/etc/vim/vimrc文件后面添加下面三句

1
2
3
set nu  #显示行号
syntax on #语法高亮
set tabstop=4 #tab退四格

这篇笔记整理自我自己的实践记录,如果做法有出入,或者你踩过别的坑,欢迎到留言板一起聊聊。

站内搜索

没有找到内容!