树莓派4b安装Raspberry Pi OS(64bit)

1.下载Raspberry Pi OS(64bit) bullseye 系统镜像

https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz

无需桌面环境,选择最小的Raspberry Pi OS Lite 64bit

2.使用Raspberry Pi Imager将系统镜像写入U盘或SD卡

windows系统写入U盘完毕后需要给boot分区添加盘符挂载分区,右键我的电脑–管理–磁盘管理,选中U盘boot分区,右键–更改驱动器号和路径(C),添加一个驱动器号。选中boot分区,右键–打开(O)。

3.启用SSH

在boot分区下新建一个文件名ssh的空文件即可,无后缀

4.配置WIFI

在boot分区下新建一个文件名为wpa_supplicant.conf的文件,用记事本打开编辑。复制以下内容,wifi名称与密码自行替换

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=CN
update_config=1

network={
 ssid="yourSSID"
 psk="yourpassword"
}

保存,编码UTF-8

5.将SD卡或U盘插入树莓派,连接电源启动

6.修改默认密码

SSH登录树莓派,树莓派IP地址可以在路由器管理界面查看,默认用户名pi,默认密码raspberry,首先修改pi用户密码

passwd pi

修改root用户密码

sudo passwd root

7.apt源更换为国内源

首先清空原有的/etc/apt/sources.list/etc/apt/sources.list.d/raspi.list文件

sudo echo > /etc/apt/sources.list && sudo echo > /etc/apt/sources.list.d/raspi.list

添加国内源,以TUNA源为例

修改 /etc/apt/sources.list文件

sudo cat << EOF > /etc/apt/sources.list
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
EOF

这里要注意,Raspberry Pi OS arm64使用的必须是debian源

修改 /etc/apt/sources.list.d/raspi.list 文件

sudo cat << EOF > /etc/apt/sources.list.d/raspi.list
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bullseye main
EOF

更新

sudo apt update && sudo apt upgrade-y