Try   HackMD

樹莓派上安裝Ubuntu

GOGO!

前情提要

 我使用的是Raspberry Pi 4,安裝 Ubuntu20.04 server版。

需要準備的東西:
  ● Raspberry Pi 4
  ● micro SD卡 / micro SD讀卡機
  ● 外接螢幕/鍵盤/(滑鼠)
  ● micro HDMI轉接線


安裝步驟

  1. 首先,在自己的電腦上,GOOGLE搜尋 Install Ubuntu on a Raspberry Pi 選擇Ubuntu官網或點以下連結

  2. 下載映像檔。我要安裝的是Ubuntu 20.04,目前官網只提供該版本的server版。如果你是想安裝Desktop版本,也可以先下載server版,之後可以透過終端指令安裝。下載並解壓縮後,得到映像檔,圖示如下。

    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 →
  3. 燒錄映像檔至SD卡。燒錄的方法有很多種,這裡介紹我使用的工具,Rufus (只需下載Portable版本,不需安裝,即可使用)。打開Rufus後,紅色圈圈處選擇映像檔,按下執行,完成後選擇離開。

    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 →

    小提醒:燒錄不是像一般我們將檔案儲存到隨身碟一樣,請不要將映像檔直接拉入資料夾中。

  4. 將SD卡插回樹莓派上,已經完成一半了!

  5. 注意:開機前請先將外接螢幕的HDMI線及鍵鼠的USB插上,全部確定好後, 最後再開啟電源

  6. 樹莓派成功開機後,會顯示以下登入畫面。預設的帳號密碼皆為ubuntu,輸入後它會要求更改新密碼。

    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 →
  7. 成功登入後,先設定網路。

    (1)確認網卡名稱,我的是wlan0。

    ​​​​sudo lshw

    (2)移至目錄/etc/netplan底下。

    ​​​​cd /etc/netplan/

    (3)打開文件 50-cloud-init.yaml。

    ​​​​sudo nano 50-cloud-init.yaml

    (4)修改 50-cloud-init.yaml文件內容成以下。

    ​​​​network: ​​​​ version: 2 ​​​​ ethernets: ​​​​ eth0: ​​​​ optional: true ​​​​ dhcp4: true ​​​​ wifis: ​​​​ wlan0: ​​​​ optional: true ​​​​ access-points: ​​​​ "your_SSID_name": ​​​​ password: "your_network_password" ​​​​ dhcp4: true

    (5)儲存文件退出後,輸入以下指令debug,並apply。

    確認剛剛的文件有沒有error。

    ​​​​sudo netplan -debug try

    如果出現error,以下指令可以進一步看到error message。

    ​​​​sudo netplan --debug generate

    確認沒問題後,apply這個檔案。

    ​​​​sudo netplan --debug apply
  8. 重新啟動ubuntu

    ​​​​sudo reboot
  9. update & upgrade

    ​​​​sudo apt-get update
    ​​​​sudo apt-get upgrade
  10. Ubuntu server版安裝完成!

  11. 如果你要安裝的是Desktop版,請繼續執行下面的指令。

    ​​​​sudo apt-get install ubuntu-desktop

    (會等上一陣子)

    ​​​​sudo reboot

    Ubuntu Desktop版安裝完成!


寫於2022/2/16