如何在沒有螢幕或鍵盤的情況下設置Raspberry Pi
- 有 一種方法可以設置和處理樹莓派,而無需將其連接到螢幕或鍵盤。它被稱為無頭(headless)運行樹莓派。
- 本文使用 Raspberry Pi 3 B+ 進行初始設定
- 使用Raspbian with desktop
- Version:February 2020
- Release date:2020-02-13
- Kernel version:4.19
需要配備
- 一台可上網的電腦
- SD card讀卡機
- 乙太網路線
- ' 當前使用的網路路由器
需要軟體
設置步驟
- 任何大於32GB的SD卡都是SDXC卡,為exFAT文件系統。樹莓派僅支援FAT32,需要先將其重新格式化。
- 用Win32 Disk Imager將Raspbian 映像寫入SD卡
- 映像寫入完成後,創建一個名為“SSH”的空文件,並將其放在SD卡的根分區中。
- SD卡插入樹莓派。
- 使用乙太網路線將樹莓派連接到您的網路路由器,然後插入電源線使樹莓派啟動。
- 打開Advanced IP Scanner,掃描找出樹莓派的IP。
- 打開PuTTY,在“Host name”輸入框中輸入樹莓派連本地IP地址,並點擊“Open”以啟動連接。
- 在第一次連接嘗試時,將出現安全性警告。只需按“是”,因為您要連接到自己的樹莓派。
- 出現登入畫面。如果這是您第一次登錄而且尚未更改用戶名或密碼,請輸入pi作為用戶名,輸入raspberry作為密碼。
- 輸入
sudo raspi-config
進入設置菜單來配置樹莓派
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
初始wifi設定
- 輸入
sudo raspi-config
進入設置菜單
- Network Options > Wi-fi
- 選擇 Wi-fi country
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 輸入SSID及passphrase
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
本地化設定
- 輸入
sudo raspi-config
進入設置菜單
- Localisation Options
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- Localisation Options > Change Locale
- en_US.UTF-8 (default)
- zh_TW.UTF-8
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- Localisation Options > Change Timezone > Asia > Taipei
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
介面設定
- 輸入
sudo raspi-config
進入設置菜單
- Interfacing Options
- 開啟 SSH, VNC, 其餘看需求設定
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
手動增加wifi
step1:
使用文本編輯器編輯wpa_supplicant.conf
。
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
wpa_supplicant.conf :
若要將PSK加密,可以使用wpa_passphrase
實用程序生成加密的PSK。
程序會直接提供輸入行,請輸入密碼後按Enter。
輸入的密碼會輸出到屏幕,請注意。
程序加密完密碼後,會將配置內容附加到wpa_supplicant.conf
。
最後在使用文本編輯器編輯wpa_supplicant.conf
。
step2:
-
啟用dhcpcd
服務(開機啟動)
sudo systemctl enable dhcpcd
-
手動啟動dhcpcd
服務
sudo systemctl start dhcpcd
-
重新啟動dhcpcd
服務
sudo systemctl restart dhcpcd
ifconfig wlan0
inet addr
字段旁邊有一個IP位址,表明Raspberry Pi已連接到網絡。
更改使用者(pi)密碼
- 輸入
sudo raspi-config
進入設置菜單
- Change User Password
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 輸入新的密碼及確認密碼,成功修改後重開機
sudo reboot
。
遠端桌面
- 輸入
sudo raspi-config
進入設置菜單
- Interfacing Options > VNC > enable
- 重開機
sudo reboot
遠端桌面操控
預設(RealVNC)
- 讓樹莓派使用區域網路的WiFi連線
- 打開Advanced IP Scanner,掃描找出樹莓派的IP
- 本地電腦 下載 VNC Viewer並開啓VNC Viewer
- 選擇 File > New connection,開始設置Properties
- 在General頁籤
- VNC Server = 樹莓派IP
- Name = 自訂名稱
- 在Options頁籤
- 取消勾選view-only
- Scaling選Automatic,勾選Preserve aspect ratio
- 創建完成後,啟動connection,並輸入帳號密碼即可遠端桌面操控
中文輸入法
- 更新套件資料庫
sudo apt update
- 安裝SCIM新酷音輸入法
sudo apt-get install scim-chewing
- 重開機
sudo reboot
- 選擇SCIM
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 介面(前端) > 全域設定 > 下一種輸入法 > 設定左邊shift為切換語言鍵

- 輸入法引擎 > 全域設定 > 設定所需的中文輸入法

- 重開機
sudo reboot
參考