📦 Raspberry Pi 3 B 設定筆記

這是當時唸書時,為了研究分散系統而建的樹莓派小樹叢紀錄,塞在 Notion 筆記裡面。但只寫了其中一小部份,所以具體來說,做法現在我其實也忘光了 XDD”

作業系統選擇

無線網路

  • 準備好 SD 卡後,直接編輯在 system-boot 放入 network-config 檔案。格式為:
    1
    2
    3
    4
    5
    6
    7
    wifis:
    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
    5
    sudo 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 # 使用新設定