树莓派系统安装指南
介绍
树莓派4B自2019年6月发布,官方发布有Raspberry Pi OS系统,但是其他的第三方操作系统可以使用。
官方镜像下载
主要有 32位/armv7l 和64位/arrch64两种。
使用 Raspberry Pi Imager 镜像烧录工具下载。官方链接:https://www.raspberrypi.com/software/
官方镜像烧录
- 选择树莓派版本
- 选择操作系统版本
- 选择存储卡
- 烧录前配置好树莓派的SSH链接和WIFI功能(如果没有可以让树莓派用的显示器)
- 烧录
- 完成
SSH 链接树莓派
- 需要知道树莓派的IP地址,可以打开路由器等查看树莓派的ip地址
- mac、windows、linux都可以使用该命令
ssh pi@127.0.0.1 #将127.0.0.1 替换为树莓派的IP地址
- 第一次链接输入yes后,输入设置的密码
- ssh连接完成
注意:
vim /etc/ssh/sshd_config
------------------------------------------------
ClientAliveInterval 30
ClientAliveCountMax 120
VNC 控制
介绍
VNC(Virtual Network Computing)是一种远程桌面控制协议和系统,允许用户通过网络远程访问和控制另一台计算机。使用VNC,你可以在一台计算机上显示和操作另一台计算机的图形界面。
使用
- 在被控制的树莓派上开启VNC功能
raspi-config #打开树莓派配置
- 选择Interfacing Options
- 选择VNC,状态修改为enabel
- 在控制的主机上安装VNC客户端
- 在VNC客户端输入树莓派IP地址
- 输入账号密码
- 完成
修改国内源
针对32位/armv7l 和64位/arrch64两种不同的架构,需要使用不同的软件源。64位/arrch64系统直接使用的debian的源,而32位/armv7l则不能使用debian的源。需要使用raspberry自己的源。
sources.list
该文件是官方的软件仓库;
在该文档中的有一些选项https://mirrors.tuna.tsinghua.edu.cn/help/debian/
路径:/etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# 以下安全更新软件源包含了官方源与镜像站配置,如有需要可自行修改注释切换
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
raspi.list
该文件是树莓派专用的软件仓库。
路径:/etc/apt/sources.list.d/raspi.list
deb https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bookworm main
注意:deb 和deb-src连接不同,默认注释是为了每次update速度更快。但是有一些包没有在deb中,需要取消deb-src的注释才能找到并安装。
更新
在更换软件源之后,输入 以下命令更新软件。
sudo apt update #更新本地软件包列表
sudo apt upgrade #升级系统中已安装的软件包到最新版本
作者:Mati1da