1 準備作業
1.1 設備資訊
- 型號:Raspberry Pi 4B+
- 記憶體(RAM):4 GB
- 存盤(ROM):16 GB(這里是閃迪卡,一定要是空的)
1.2 鏡像資訊
- [不推薦] 2020-08-20-raspios-buster-arm64.img(之前在清華開源軟體站下的 64 位的版本,現在找不到了,暫時也不想找,有需要的可以到官網下,也可以到清華開源軟體站下,有些硬體可能用的是 32 位的驅動(比如說3.5的螢屏驅動),因此不首先推薦安裝 64 位的系統)
- 2020-12-02-raspios-buster-armhf.img(傳送門:https://mirrors.tuna.tsinghua.edu.cn/raspberry-pi-os-images/raspios_armhf/images/raspios_armhf-2020-12-04/2020-12-02-raspios-buster-armhf.zip,資源來自
清華開源軟體站)
樹莓派官網提供的鏡像是 .ISO 的,但是提供的 Raspberry Pi Imager 卻不支持,ISO 轉 IMG 有點麻煩,所以就直接在清華開源軟體站下了,解壓就能用,
1.3 工具
- Raspberry Pi Imager v 1.4(官網下的,傳送門https://www.raspberrypi.org/software/)
2 安裝步驟
2.1 Step 1 燒錄 SD 卡
2.1.1 選擇鏡像


往下滑動,找到 Use custom 點擊

在彈出的對話框中找到存放鏡像的路徑,選擇鏡像

2.1.2 選擇 SD 卡


2.1.3 開始燒錄
點擊 WRITE,開始燒錄

選擇 YES

剩下就是等待,,,30 分鐘內就完成了

選擇 CONTINUE
3 初始化樹莓派
3.1 添加組態檔
將 SD 卡拔下之后重新插入讀卡器,進入磁盤 boot,找到 config.txt ,將里面的內容替換為下方內容
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1
3.2 添加 WiFi 配置
如果自己有輸出的螢屏,可以直接插上線啟動樹莓派,然后再自己手動配置 WiFi 資訊即可,如果沒有,那么就要設定一下了,不然沒法通過 ssh 連接上它,
在 config.txt 同一目錄下,新增一個檔案 wpa_supplicant.conf,然后輸入以下內容,(注意:這里需要連接的 WiFi 是沒有密碼的,有密碼的沒有測驗過,下次測驗了之后再補充上來)
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={
ssid="WiFi名稱"
key_mgmt=NONE
}
先啟動樹莓派,
4 啟動樹莓派
樹莓派插上 SD 卡,插上 Type-C 電源線,插上鍵鼠,
(注意:不要插上 HDMI 線,原先測驗的時候,想看一下 WiFi 的連接狀態,結果無論如何都連不上 WiFi,后面重新刷了系統之后沒有連接 HDMI 線,樹莓派就自動連接上 WiFi 了,如果有知道什么原因的小伙伴可以在評論區給我留言,感激不盡)
5 連接樹莓派
這兩天發現 Win10 自帶了 SSH,突然間覺得手上的 XShell6 不香了,試用了一下之后發現,Win10 的更方便,感覺可以準備不用 XShell 了,先試用一段時間再說,
由于連接無線路由器,因此我們可以在路由器的管理界面中找到樹莓派的 IP 地址,找到之后,我們可以通過 SSH 對它進行連接,
5.1 添加 ssh
在 config.txt 同一目錄下,新增一個檔案 ssh 即可,
5.2 ssh 連接
樹莓派默認的登錄名為 pi, 密碼為 raspberry,
ssh pi@ip地址

到此,這里就進入了樹莓派的系統了,
6 配置樹莓派
6.1 修改初始密碼
# 修改樹莓派初始密碼
sudo passwd pi
# 修改 root 密碼
sudo passwd root
6.2 修改系統語言
sudo raspi-config

選擇 Localisation Options

選擇 Locale

用方向鍵一直往下,找到上圖中打 * 號的幾個選項,使用空格鍵選中
- zh_CN GB2312
- zh_CN.GB18030 GB18030
- zh_CN.GBK GBK
- zh_CN.UTF-8 UTF-8

選擇默認語言 zh_CN.UTF-8 UTF-8 ,選擇 確定 之后等待設定,
設定完成后,重新啟動樹莓派,
sudo reboot
6.3 修改軟體源
# 備份軟體源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.backup
# 打開軟體源
sudo nano /etc/apt/sources.list
將檔案里的所有內容替換為以下內容
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi
# 打開樹莓派源
sudo nano /etc/apt/sources.list.d/raspi.list
將檔案里的所有內容替換為以下內容
deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui
執行完以上操作后,執行樹莓派系統更新
sudo apt-get update
sudo apt-get upgrade
接下來的慢慢等待就好
6.4 修改 Python 源
sudo nano /etc/pip.conf
將里面的內容替換為
[global]
extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple
6.5 配置 3.5 寸螢屏驅動
因為 Yogurt 買了一個 3.5 寸的螢屏,所以需要安裝驅動才能運行,這一步不是必須的,
git clone https://github.com/goodtft/LCD-show.git
cd LCD-show/
sudo su
./LCD35-show

需要注意的是:在 Yogurt 測驗一天一夜的程序中,發現并不是所有的螢屏驅動都是能用的,因此需要看一下購買時的說明書或者卡片,再來安裝驅動,
7 連接 VNC
看習慣了圖形界面,看命令列可能會有點不習慣,那么就需要遠程桌面來解決了,這里用的是 VNC Viewer,樹莓派已經預裝了,我們只要在控制端安裝 VNC 工具就好了,
下載傳送門:https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.20.529-Windows.exe

安裝完打開之后就是這個樣子了,
在最上面輸入樹莓派的 IP 地址即可連接,

選擇 Continue

輸入樹莓派的 登錄名 和 密碼

進入系統之后就是這樣了,這里螢屏小是因為這臺是有一個 3.5 寸螢屏,所以遠程也是按照這個螢屏 480 x 360 的解析度來的,正常來說,都會默認為1280 x 720 的,
以上就是本次樹莓派安裝的全部程序了,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/243918.html
標籤:其他
