Install Ubuntu 20.04 on Raspberry Pi 4B

https://wiki.ubuntu.com/ARM/RaspberryP

download ubuntu server

https://ubuntu.com/download/raspberry-pi

use Raspberry Pi Imager

https://www.raspberrypi.org/downloads/

Use Raspberry Pi Imager for an easy way to install Raspberry Pi OS and other operating systems to an SD card ready to use with your Raspberry Pi

use cmd on mac

yuyangdeMacBook-Pro:Downloads yuyang$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         121.1 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +121.1 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume disk - 数据             78.6 GB    disk1s1
   2:                APFS Volume Preboot                 81.3 MB    disk1s2
   3:                APFS Volume Recovery                528.5 MB   disk1s3
   4:                APFS Volume VM                      3.2 GB     disk1s4
   5:                APFS Volume disk                    10.7 GB    disk1s5

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk2
   1:             Windows_FAT_32 NO NAME                 31.9 GB    disk2s1

yuyangdeMacBook-Pro:Downloads yuyang$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
yuyangdeMacBook-Pro:Downloads yuyang$ sudo dd bs=1m if=ubuntu-18.04.3-server-arm64.iso of=/dev/disk2 conv=sync
Password:
Sorry, try again.
Password:
902+1 records in
903+0 records out
946864128 bytes transferred in 353.327691 secs (2679847 bytes/sec)
sudo sh -c 'gunzip -c ~/Downloads/< image file > | sudo dd of=< drive address > bs=32m'

Ubuntu 20.04: Connect to WiFi from command line with Netplan step by step instructions

vim /etc/netplan/50-cloud-init.yaml

sudo netplan apply
# sudo netplan --debug apply
# 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
    wifis:
        wlp3s0:
            optional: true
            access-points:
                "SSID-NAME-HERE":
                    password: "PASSWORD-HERE"
            dhcp4: true

enable ssh

sudo apt update
sudo apt install openssh-server
sudo system status ssh

update source with ustc if you in china

http://mirrors.ustc.edu.cn/help/ubuntu-ports.html

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal main main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse

Install a desktop

You can install a desktop if you like, here are some popular ones:

sudo apt-get install xubuntu-desktop
sudo apt-get install lubuntu-desktop
sudo apt-get install kubuntu-desktop
sudo apt-get install ubuntu-desktop

# sudo apt autoremove kubuntu-desktop