下载地址
Raspbian buster默认不开启ssh server服务,需要在TF卡根目录boot下新建ssh文件
touch ssh
在TF卡根目录下新建一个txt文件,并重命名为ssh(不保留后缀名)。
在TF卡根目录boot下新建wpa_supplicant.conf,并输入以下配置:
country=CN ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="XXXX" #你的无线网络名称 psk="XXX" #你的无线网络密码 priority=5 }
sudo raspi-config
sudo passwd root
pi@raspberrypi:~ $ sudo apt -y update pi@raspberrypi:~ $ sudo apt -y upgrade pi@raspberrypi:~ $ sudo apt autoremove
pi@raspberrypi:~ $ sudo apt install python3-pip
pi@raspberrypi:~ $ sudo pip3 install -–upgrade pip
pi@raspberrypi:~ $ sudo pip3 install awscli
pi@raspberrypi:~ $ sudo pip3 install docker-compose
pi@raspberrypi:~ $ curl -fsSL https://get.docker.com -o get-docker.sh pi@raspberrypi:~ $ sudo sh get-docker.sh
pi@raspberrypi:~ $ curl -fsSL https://get.docker.com -o get-docker.sh pi@raspberrypi:~ $ sudo sh get-docker.sh --mirror=Aliyun
Install Docker Engine
pi@raspberrypi:~ $ sudo vim /etc/docker/daemon.json pi@raspberrypi:~ $ cat /etc/docker/daemon.json { "registry-mirrors": [ "https://docker.mirrors.ustc.edu.cn/", "https://hub-mirror.c.163.com/" ] }
备选镜像源:
重启docker服务
pi@raspberrypi:~ $ sudo systemctl daemon-reload pi@raspberrypi:~ $ sudo systemctl restart docker
pi@raspberrypi:~ $ sudo fdisk -l Disk /dev/mmcblk0: 29.8 GiB, 32010928128 bytes, 62521344 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x90f2d69d Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 532480 62521343 61988864 29.6G 83 Linux Disk /dev/sda: 1.8 TiB, 2000398931968 bytes, 3907029164 sectors Disk model: External USB 3.0 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5e03fb62 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 3907023023 3907020976 1.8T 7 HPFS/NTFS/exFAT
可以看到待挂载硬盘/dev/sda1
pi@raspberrypi:~ $ sudo fdisk /dev/sda1 Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. # 删除硬盘原分区 Command (m for help): d Selected partition 1 Partition 1 has been deleted. # 添加硬盘新分区 Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) # 添加分区,默认的分区格式是 primary Select (default p): Using default response p. # 分区号默认 1 Partition number (1-4, default 1): # 指定分区的起始扇区,一般默认 2048 First sector (2048-62668799, default 2048): # 指定分区的终止扇区,一般默认最大值 Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62668799, default 62668799): Created a new partition 1 of type 'Linux' and of size 1.8 TiB. Partition #1 contains a vfat signature. # 询问删除签名,确认:y Do you want to remove the signature? [Y]es/[N]o: y The signature will be removed by a write command. # 保存修改 Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
pi@raspberrypi:~ $ sudo fdisk -l Disk /dev/mmcblk0: 29.8 GiB, 32010928128 bytes, 62521344 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x90f2d69d Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/mmcblk0p2 532480 62521343 61988864 29.6G 83 Linux Disk /dev/sda: 1.8 TiB, 2000398931968 bytes, 3907029164 sectors Disk model: External USB 3.0 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5e03fb62 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 3907023023 3907020976 1.8T 7 Linux
Make a Linux filesystem.
mkfs [options] [-t <type>] [fs-options] <device> [<size>]
e.g.
sudo mkfs -t ext4 /dev/sdb1
# 临时挂载到/mnt pi@raspberrypi:~ $ sudo mount /dev/sda1 /mnt # 查看挂载情况 pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 30G 2.0G 26G 8% / devtmpfs 341M 0 341M 0% /dev tmpfs 373M 0 373M 0% /dev/shm tmpfs 373M 9.8M 364M 3% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 373M 0 373M 0% /sys/fs/cgroup /dev/sda1 1.9T 432G 1.4T 24% /mnt
Debian 使用 UUID 来实现硬盘自动挂载。通过blkid
来查看/dev/sda1
的UUID
pi@raspberrypi:~ $ sudo blkid /dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="5DE4-665C" TYPE="vfat" PARTUUID="90f2d69d-01" /dev/mmcblk0p2: LABEL="rootfs" UUID="7295bbc3-bbc2-4267-9fa0-099e10ef5bf0" TYPE="ext4" PARTUUID="90f2d69d-02" /dev/mmcblk0: PTUUID="90f2d69d" PTTYPE="dos" /dev/sda1: LABEL="Win" UUID="E6FEF4E4FEF4ADC5" TYPE="ntfs" PARTUUID="5e03fb62-01"
添加挂载点,配置自动挂载
pi@raspberrypi:~ $ sudo vim /etc/fstab proc /proc proc defaults 0 0 PARTUUID=90f2d69d-01 /boot vfat defaults 0 2 PARTUUID=90f2d69d-02 / ext4 defaults,noatime 0 1 # a swapfile is not a swap partition, no line here # use dphys-swapfile swap[on|off] for that UUID="E6FEF4E4FEF4ADC5" /mnt ntfs defaults 0 0
配置完成后,可以sudo reboot
,并使用df -h
检查自动挂载情况。
制作树苺派SD卡备份镜像——树苺派系统备份与还原指南