验证引导模式
ls /sys/firmware/efi/efivars
// 如果结果显示了目录且没有报告错误,则系统是以 UEFI 模式引导的
// 没有东西的话,换一片文章看吧
联网
# systemctl stop reflector.service //禁止自动更新服务器列表
// 这一步一定要先,不然联网之后,mirrorlist里的文件就被更新了
# iwctl // 启动iwctl
# device list // 找到联网的设备
# station wlan0 scan // 扫描附近的网络
# station wlan0 get-networks // 动态显示附近的网络
# station wlan0 connect wifiName
// 输入密码
# exit
更改pacman镜像源
# vim /etc/pacman.d/mirrorlist
// 搜索ustc,将两个中科大的地址放到文件最前面
# pacman -Syy
分区
使用cfdisk进行分区
# fdisk -l // 查看磁盘的名称 /dev/sda ...
# cfdisk 磁盘名称
分三个区
- EFI System: 300m
- Linux swap: 物理内存/2
- Linux filesystem: 剩下的空间
格式化分区
# fdisk -l // 查看分区
# mkfs.ext4 /dev/root_partition(根分区)
# mkswap /dev/swap_partition(交换空间分区)
# mkfs.fat -F 32 /dev/efi_system_partition
挂载分区
# mount /dev/root_partition(根分区) /mnt
// --mkdir 创建并挂载
# mount --mkdir /dev/efi_system_partition /mnt/boot
# swapon /dev/swap_partition(交换空间分区)
安装系统
# pacstrap /mnt linux linux-firmware base base-devel neovim git bash-completion intel-ucode grub efibootmgr networkmanager
生成文件系统的表文件
# genfstab -U /mnt >> /mnt/etc/fstab
# cat /mnt/etc/fstab
进入新系统
# arch-chroot /mnt
设置时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
设置系统语言
# vim /etc/locale.gen
// en_US.UTF-8 UTF-8 取消注释这一行
# locale-gen
# nvim /etc/locale.conf
// 输入 LANG=en_US.UTF-8
网络配置
主机设置
nvim /etc/hostname // 输入主机名
生成对应的hosts
# vim /etc/hosts
// archlinux 是上面的主机名
127.0.0.1 localhost
::1 localhost
127.0.1.1 archlinux.localdomain archlinux
激活启用NetworkManager
# systemctl enable NetworkManager // 方便重启之后联网
给root设置密码
# passwd
添加用户
# useradd -m -G wheel -s /bin/bash alonescar
EDITOR=nvim visudo
将%wheel ALL=(ALL) ALL 去掉注释
// TODO
passwd alonescar // 为用户设置密码
添加ArchLinuxCN 存储库
# vim /etc/pacman.conf
// 将文件末尾的multilib以及include的注释去掉
并在下面添加
[archlinuxcn]
Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch
# pacman -Syyu // 若要安装一些东西,选择no
# pacman -S archlinuxcn-keyring // 安装密钥
添加开机启动项
# grub-install --target=x86_64-efi --efi-directory=/boot
# grub-mkconfig -o /boot/grub/grub.cfg
重启
# exit
# umount -R /mnt
# reboot
联网
# nmtui
// 选择Activate a connection