這是當時唸書時,為了研究分散系統而建的樹莓派小樹叢紀錄,塞在 Notion 筆記裡面。但只寫了其中一小部份,所以具體來說,做法現在我其實也忘光了 XDD”
作業系統選擇
- Raspberry OS: 樹梅派專用作業系統(不能裝外部的相關套件,如 ethereum)
- Ubuntu Core: 專門為 headless device 的作業系統(沒有 apt 且 nodejs 有一點障礙)
- Ubuntu: 就跟一般的一樣。
https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview
無線網路
- 準備好 SD 卡後,直接編輯在
system-boot放入network-config檔案。格式為:1
2
3
4
5
6
7wifis:
wlan0:
dhcp4: true
optional: true
access-points:
<wifi network name>:
password: "<wifi password>" - 若忘記上面那步,就編輯
/etc/netplan/50-cloud-init.yaml檔案:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
eth0:
dhcp4: true
optional: true
version: 2
# wifi configrations
wifis:
wlan0:
optional: true
access-points:
"LAUFUA-403":
password: "C3CXBMRP"
dhcp4: true - 可以先備份,再做測試:
1
2
3
4
5sudo cp 50-cloud-init.yaml 50-cloud-init.yaml.bak # 備份 .yaml
sudo chmod 640 /etc/netplan/50-cloud-init.yaml # 設定存取權限
sudo vim 50-cloud-init.yaml # 編輯 .yaml
sudo netplan --debug try # 測試網路設定
sudo netplan --debug apply # 使用新設定