1,官网下载系统https://www.raspberrypi.org/software/operating-systems/

2,我选的是Ubuntu Desktop,我选时候是20.04和21,没有18.04了,所以找了很久,在ubuntu官网找到了ubuntu server版本18.04.5,支持树莓派2,3,4
http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.5-preinstalled-server-arm64+raspi3.img.xz

3,烧录工具 https://www.balena.io/etcher/

4,烧录后,不拔出sd卡,可以看到我的电脑有boot的盘符,进去修改network-config文件(首次没启动树莓派前,如果放sd卡到树莓派,再拿出来修改,就不行)

version: 2
ethernets:
  eth0:
    dhcp4: true
    optional: true
wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "Xiaomi_60C2":
        password: "yannuo88888888"

5,如果有7寸屏幕HDMI的,要在config.txt文件末尾加入

max_usb_current=1
hdmi_force_hotplug=1 
config_hdmi_boost=10
hdmi_group=2 
hdmi_mode=87 
hdmi_cvt 1024 600 60 6 0 0 0

注:如果是Raspberry Pi 4,还需要把dtoverlay=vc4-fkms-V3D注释掉。

6,插入树莓派,启动,然后应该还是不能联网,这时候,再次重启一次树莓派,就会连好了网

sudo reboot

7,换源,就是把源网址的xx.xx.com换成了mirrors.aliyun.com

sudo vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu-ports bionic main restricted
deb http://mirrors.aliyun.com/ubuntu-ports bionic-updates main restricted
deb http://mirrors.aliyun.com/ubuntu-ports bionic universe
deb http://mirrors.aliyun.com/ubuntu-ports bionic-updates universe
deb http://mirrors.aliyun.com/ubuntu-ports bionic multiverse
deb http://mirrors.aliyun.com/ubuntu-ports bionic-updates multiverse
deb http://mirrors.aliyun.com/ubuntu-ports bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu-ports bionic-security main restricted
deb http://mirrors.aliyun.com/ubuntu-ports bionic-security universe
deb http://mirrors.aliyun.com/ubuntu-ports bionic-security multiverse