blog/source/_posts/Arch Linux/在树莓派上安装 Arch Linux.md
2022-08-31 14:15:07 +08:00

56 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 在树莓派上安装 Arch Linux
sitemap: true
keywords:
- Raspberry Pi
- 树莓派
- 安装
- Arch Linux
categories:
- Arch Linux
tags:
- Raspberry Pi
- Arch Linux
date: 2022-08-31 08:13:32
---
安装方法汲取自
- https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
- https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4
``` bash Install Arch Linux on Raspberry Pi 3 & 4
# 将 SD 卡插入台式电脑操作
fdisk /dev/sdX # 分区
mkfs.vfat -n BOOT /dev/sdX1 # 200M 做 FAT32(LBA) 分区
mkfs.ext4 -L ROOT /dev/sdX2 # 剩余空间做 Linux 分区
mkdir boot root
mount /dev/sdX1 boot
mount /dev/sdX2 root
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
bsdtar -xpvf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root
mv root/boot/* boot -v
sed -i 's/mmcblk0/mmcblk1/g' root/etc/fstab # 注意仅树莓派4需要
sync && sync
umount boot root
rmdir boot root
# 将 SD 卡插入树莓派后启动
# the default user alarm with the password alarm
# the root password is root
pacman-key --init
pacman-key --populate archlinuxarm
hostnamectl set-hostname zhao
vim /etc/hosts
timedatectl set-timezone Asia/Shanghai
usermod -d /home/xin -m alarm
usermod -l xin alarm
groupmod -n xin alarm
echo "Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/$arch/$repo" >> /etc/pacman.d/mirrorlist
pacman -Syyu sudo vim git fish nginx
echo "kernel.printk = 3 3 3 3" >> /etc/sysctl.d/20-quiet-printk.conf
echo "enable_uart=1 nomodeset quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3" >> /boot/config.txt
echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
passwd root
passwd xin
chsh -s /usr/bin/fish
```