ArchLinux安装笔记
Created 2025-08-19 / Updated 2025-08-19在BIOS中关闭「安全启动」。
u盘启动后,按如下步骤安装ArchLinux。
配置网络:
# iwctl
[iwd]# device list
[iwd]# station <name> scan
[iwd]# station <name> get-networks
[iwd]# station <name> connect <SSID>
查看分区:
# fdisk -l
修改分区:
# fdisk /dev/nvme0n1
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 2099199 2097152 1G EFI System
/dev/nvme0n1p2 2099200 85985279 83886080 40G Linux filesystem
/dev/nvme0n1p3 85985280 354420735 268435456 128G Linux filesystem
格式化efi
分区:
# mkfs.fat -F 32 /dev/nvme0n1p1
格式化根分区与/home
分区:
# mkfs.ext4 /dev/nvme0n1p2
# mkfs.ext4 /dev/nvme0n1p3
关闭日志:
# tune2fs -O "^has_journal" /dev/nvme0n1p2
# tune2fs -O "^has_journal" /dev/nvme0n1p3
挂载分区:
# mount /dev/nvme0n1p4 /mnt
# mkdir /mnt/efi
# mount /dev/nvme0n1p1 /mnt/efi
# mkdir /mnt/home
# mount /dev/nvme0n1p3 /mnt/home
使用国内镜像源:
# curl -L 'https://archlinux.org/mirrorlist/?country=CN&protocol=https&ip_version=4&ip_version=6' -o /etc/pacman.d/mirrorlist
(然后编辑该/etc/pacman.d/mirrorlist
文件,选择要使用的镜像源,去掉前面的注释)
安装基本系统:
# pacstrap -K /mnt base linux linux-firmware vim
生成fstab文件:
# genfstab -U /mnt >> /mnt/etc/fstab
(编辑生成的/mnt/etc/fstab
文件,为根分区挂载增加noatime,commit=60,barrier=0
选项)
chroot到新安装的系统:
# arch-chroot /mnt
设置时区:
# ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
生成/etc/adjtime
:
# hwclock --systohc
为vim
创建一个vi
软链接:
# ln -s /usr/bin/vim /usr/bin/vi
编辑/etc/locale.gen
,去掉en_US.UTF-8
和zh_CN.UTF-8
的注释,然后运行:
# locale-gen
设置LANG
变量:
# vi /etc/locale.conf
LANG=en_US.UTF-8
设置主机名
:
# vi /etc/hostname
主机名
设置root的密码:
# passwd
安装微码:
# pacman -S intel-ucode
安装grub:
# pacman -S grub efibootmgr
# grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
# grub-mkconfig -o /boot/grub/grub.cfg
安装iwd:
# pacman -S iwd
配置iwd:
# mkdir /etc/iwd
# vi /etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true
[Network]
RoutePriorityOffset=300
NameResolvingService=systemd
卸载分区并重启:
# exit
# umount /mnt/efi
# umount /mnt/home
# umount /mnt
# shutdown -r now
调节屏幕亮度:
# echo 5760 > /sys/class/backlight/intel_backlight/brightness
配置systemd-resolved:
# vi /etc/systemd/resolved.conf
DNS=8.8.8.8 8.8.4.4
# ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
# systemctl enable --now systemd-resolved.service
启动iwd并配置网络:
# systemctl start iwd.service
# iwctl
[iwd]# device list
[iwd]# station <name> scan
[iwd]# station <name> get-networks
[iwd]# station <name> connect <SSID>
更新系统:
# pacman -Syu
安装各种软件包:
# pacman -S sway
# pacman -S foot
# pacman -S noto-fonts-cjk
# pacman -S fcitx5-rime
# pacman -S firefox
声音:
# pacman -S alsa-utils
$ alsamixer
(声道下方标有MM表示已静音,移动到该声道,按下m取消静音,按上下方向键调节音量)
$ speaker-test -c 2
(测试声音)
参考:
- https://wiki.archlinux.org/title/Installation_guide
- https://wiki.archlinuxcn.org/wiki/安装指南
- https://wiki.archlinux.org/title/Ext4