安裝官方系統(tǒng) Raspbian Buster Lite(無(wú)桌面版)

目前安裝系統(tǒng)有兩個(gè)途徑,可以利用官方新出的 Raspberry Pi Imager 工具燒寫系統(tǒng),也可以下載系統(tǒng)鏡像后利用 Etcher 或者 win32diskimager 進(jìn)行燒寫。項(xiàng)目選擇安裝官方的 Raspbian Buster Lite。
- Raspberry Pi Imager 下載鏈接:https://www.raspberrypi.org/downloads/

- Raspbian 系統(tǒng)鏡像下載鏈接:https://www.raspberrypi.org/downloads/raspbian/

我這里選擇 Raspberry Pi OS Lite 無(wú)桌面版本
- 官方安裝教程:https://www.raspberrypi.org/documentation/installation/installing-images/README.md
- Etcher 官網(wǎng)鏈接:https://www.balena.io/etcher/

請(qǐng)根據(jù)系統(tǒng)版本下載對(duì)應(yīng)的工具,我是 Windows 10,因此對(duì)應(yīng)的為 for Windows (x86|x64)。
-
SD 卡格式化工具:https://www.sdcard.org/chs/downloads/formatter/
建議在燒寫系統(tǒng)前對(duì) SD 卡進(jìn)行格式化
格式化 SD 卡
打開下載好的 SD 卡格式化工具

系統(tǒng)燒寫
使用 Etcher 燒寫
從上述鏈接中下載 Raspberry Pi OS Lite 系統(tǒng)鏡像(下載為
zip壓縮文件,請(qǐng)解壓為img文件)以及Etcher燒寫工具。-
將 SD 卡通過(guò)讀卡器連接至你的電腦中,選擇系統(tǒng)鏡像、SD 卡盤符;點(diǎn)擊 Flash! 進(jìn)行燒寫。
圖片使用
Raspberry Pi Imager進(jìn)行燒寫我這里就不進(jìn)行演示了,大致步驟與上述是一致的
配置
SSH 配置
默認(rèn)系統(tǒng) * 不開啟 ssh 服務(wù),根目錄并新建空文件 ssh,不加后綴,即可啟動(dòng)時(shí)開始 ssh,方便遠(yuǎn)程連接
方法:將 SD 卡使用讀卡器連接到 pc 上,打開 SD 卡盤符在 boot 分區(qū)下新建 “ssh” 文本文檔,并刪除后綴.txt

WIFI 配置
- 在 boot 分區(qū)下新建 wpa_supplicant.conf 文檔
- 打開 wpa_supplicant.conf 輸入以下配置:可以用 network {} 同時(shí)配置多個(gè)無(wú)線網(wǎng)絡(luò)
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WiFi名,不刪除引號(hào),不能有中文"
psk="密碼,不刪除引號(hào)"
priority=數(shù)字,數(shù)字越大代表優(yōu)先級(jí)越高
}
network={
ssid="第二個(gè)WiFi名"
psk="第二個(gè)密碼"
priority=數(shù)字,數(shù)字越大代表優(yōu)先級(jí)越高
}
啟動(dòng)連接樹莓派
- 硬件連接并開機(jī):將 SD 卡插入樹莓派,打開電源開關(guān),樹莓派上的綠色指示燈會(huì)閃爍,說(shuō)明系統(tǒng)正常。
- 獲取樹莓派的動(dòng)態(tài) IP 地址:直接在路由器后臺(tái)中找到樹莓派 ip 地址,或者使用 Advanced IP Scanner 獲取。
- 利用 ssh 工具遠(yuǎn)程登錄樹莓派:可以使用任意你熟悉的 ssh 連接工具,我這里使用 FinalShell
- 默認(rèn)用戶名密碼:pi/raspberry

連接成功:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@raspberrypi:~ $
更換軟件源
軟件源的選擇
默認(rèn)情況下,樹莓派軟件源地址是 http://archive.raspbian.org/,位于歐洲,在國(guó)內(nèi)訪問(wèn)是非常慢的,經(jīng)常只有幾 k 每秒的下載速率。所以我們?cè)谕孓D(zhuǎn)樹莓派之前,強(qiáng)烈推薦替換成國(guó)內(nèi)的軟件源。
樹莓派的所有軟件源地址可以從這里找到:https://www.raspbian.org/RaspbianMirrors
一般我們找個(gè)國(guó)內(nèi)的就行了,比如清華大學(xué)

更換
- 備份原有文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak
- 修改
sudo nano /etc/apt/sources.list
如下列所示,將原內(nèi)容注釋,添加清華軟件源
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
#deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
按 ctrl-o 保存,按 ctrl-x 關(guān)閉
將 /etc/apt/sources.list.d/raspi.list 如法炮制
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main
#deb http://archive.raspberrypi.org/debian/ buster main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ buster main
更新系統(tǒng),就會(huì)發(fā)現(xiàn)速度快了很多了
sudo apt-get update -y && sudo apt-get upgrade -y
啟用 root
-
設(shè)置 root 密碼
sudo passwd root -
解鎖 root 用戶
sudo passwd --unlock root -
切換用戶
su root -
修改 ssh 配置允許 root 登錄
sudo nano /etc/ssh/sshd_config -
找到 PermitRootLogin, 取消注釋并修改
PermitRootLogin yes
至此,樹莓派完成了燒寫系統(tǒng) + 無(wú)屏幕的無(wú)線 wifi 遠(yuǎn)程連接。
