Arch Linux安装配置指南
1. 准备Live环境
1.1 下载并校验镜像
下载ISO镜像
进入镜像所在目录,校验签名:
pacman-key-varchlinux-version-x86_64.iso.sig1.2 制作启动U盘
- 确认U盘设备名(例如/dev/sda),确保其未挂载
lsblk- 写入镜像:
sudocatarchlinux-version-x86_64.iso>/dev/sda1- 刷写缓存并弹出:
synceject/dev/sda11.3 进入Live环境
进入BIOS,禁用Secure Boot(若存在Secure Boot Mode,设为Standard或关闭)
确认已以UEFI模式启动(输出64表示成功):
cat/sys/firmware/efi/fw_platform_size1.4 连接网络并同步时间
- 进入iwctl连接Wi-Fi:
iwctl station wlan0 connect"wifi名"# 输入密码exit- 验证网络(有IP地址即为成功):
ipa- 开启网络时间同步:
timedatectl set-ntptrue2. 磁盘分区与文件系统
2.1 分区
- 查看磁盘设备:
lsblk-pf- 对磁盘进行分区(以/dev/nvme0n1为例):
cfdisk/dev/nvme0n1删除所有已有分区(delete)
创建 EFI 分区:new → 大小 1G → type → EFI System
创建根分区:new → 使用剩余全部空间 → write 写入并 quit 退出
确认分区结果:
lsblk-pf2.2 格式化
mkfs.fat-F32/dev/nvme0n1p1# EFI 分区mkfs.btrfs-f/dev/nvme0n1p2# 根分区2.3 创建 Btrfs 子卷并挂载
- 临时挂载根分区:
mount-tbtrfs-ocompress=zstd /dev/nvme0n1p2 /mnt- 创建子卷:
btrfs subvolume create /mnt/@ btrfs subvolume create /mnt/@home btrfs subvolume create /mnt/@swap- 卸载临时挂载:
umount/mnt- 正式挂载子卷:
mount-tbtrfs-osubvol=/@,compress=zstd /dev/nvme0n1p2 /mntmount--mkdir-tbtrfs-osubvol=/@home,compress=zstd /dev/nvme0n1p2 /mnt/homemount--mkdir-tbtrfs-osubvol=/@swap,compress=zstd /dev/nvme0n1p2 /mnt/swap2.4 挂载启动分区
mount--mkdir/dev/nvme0n1p1 /mnt/bootdf-h# 检查挂载情况3. 安装基本系统
3.1 配置镜像源并安装基础包
- 更新密钥:
pacman-Syarchlinux-keyring- 编辑镜像列表,在/etc/pacman.d/mirrorlist开头添加中国源:
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch Server = https://mirrors.aliyun.com/archlinux/$repo/os/$arch- 安装基础包:
pacstrap-K/mnt base base-devel linux linux-firmware btrfs-progs pacstrap /mnt networkmanager neovim amd-ucode3.2 创建交换文件
btrfs filesystem mkswapfile--size8g--uuidclear/mnt/swap/swapfilechmod600/mnt/swap/swapfileswapon/mnt/swap/swapfile3.3 生成 fstab
genfstab-U/mnt>/mnt/etc/fstabcat/mnt/etc/fstab# 检查内容3.4 chroot 进入新系统
arch-chroot /mnt4. 系统基础配置(chroot内)
4.1 时区与硬件时钟
ln-sf/usr/share/zoneinfo/Asia/Shanghai /etc/localtime hwclock--systohc4.2 本地化设置
编辑/etc/locale.gen,取消注释en_US.UTF-8 UTF-8和zh_CN.UTF-8 UTF-8
生成本地化:
locale-gen- 设置默认语言,编辑/etc/locale.conf:
LANG=en_US.UTF-84.3 网络配置
- 设置主机名:
echo"tistath">/etc/hostname- 编辑/etc/hosts,写入:
127.0.0.1 localhost ::1 localhost 127.0.1.1 tistath.localdomain tistath4.4 设置root密码
passwd4.5 安装并配置systemd-boot
systemctl daemon-reload bootctlinstall--esp-path=/bootchmod600/boot/loader/random-seed- 创建启动项/boot/loader/entries/arch.conf:
title Arch Linux linux /vmlinuz-linux initrd /amd-ucode.img initrd /initramfs-linux.img options root=UUID=$(blkid -s UUID -o value /dev/nvme0n1p2) rootflags=subvol=@ rw loglevel=7- 配置启动管理器/boot/loader/loader.conf:
default arch timeout 3 console-mode max editor no- 生效:
systemd-machine-id-setup bootctl update4.6 安装efibootmgr并重启
pacman-Sefibootmgrexit# 退出 chrootreboot# 重启进入新系统以上是通用配置,其余按需选择
5. 用户与桌面环境
5.1 连接网络
重启后以root登录,执行:
systemctlenable--nowNetworkManager nmcli dev wifi connect"wifi名"password"密码"ipa# 验证5.2 安装Fish Shell
sudopacman-Sfish5.3 创建普通用户并配置
useradd-m-Gwheel,users-s/usr/bin/fish tistathpasswdtistathecho"tistath ALL=(ALL) ALL">/etc/sudoers.d/tistathchmod440/etc/sudoers.d/tistath完成后退出root,以tistath登录后续操作
5.4 安装图形界面与基本应用
sudopacman-Smate-polkit xdg-desktop-portal-gtk xwayland-satellite niri kitty adobe-source-han-sans-otc-fonts ttf-jetbrains-mono-nerd firefox# Firefox 的交互询问均选择2fc-cache-fv5.5 配置Niri窗口管理器
- 生成默认配置:
niri-session- 按需编辑~/.config/niri/config.kdl
- 为闲置脚本添加执行权限:
chmod+x ~/.config/niri/scripts/swayidle.sh5.6 安装通知服务
sudopacman-Slibnotify mako6. 中文输入法与加速器
6.1 添加archlinuxcn源并安装yay
- 编辑/etc/pacman.conf,添加:
[archlinuxcn] Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch Server = https://mirrors.ustc.edu.cn/archlinuxcn/$arch Server = https://mirrors.hit.edu.cn/archlinuxcn/$arch Server = https://repo.huaweicloud.com/archlinuxcn/$arch- 安装yay并配置AUR镜像:
sudopacman-Syarchlinuxcn-keyringsudopacman-Syay yay--aururl"https://aur.tuna.tsinghua.edu.cn"--save# 清华源# 若失效可恢复官方:yay --aururl "https://aur.archlinux.org" --save6.2 安装并配置fcitx5输入法
sudopacman-Sfcitx5-im fcitx5-rime rime-ice-pinyin-git- 编辑Rime配置~/.local/share/fcitx5/rime/default.custom.yaml:
patch:__include:rime_ice_suggestion:/ascii_composer:switch_key:Shift_L:commit_codeShift_R:commit_codemenu:page_size:10style:horizontal:true'engine/filters':-simplifier- 在输入法设置中添加Rime
6.3 安装Watt Toolkit加速器
yay-Swatt-toolkit-bin- 初始化证书数据库并信任证书:
mkdir-p~/.pki/nssdb certutil-N-d~/.pki/nssdbsudotrust anchor--storeSteamTools.Certificate.cersudochmoda+w /etc/hosts在Firefox的设置-安全中导入证书(用于加速GitHub)
在steam中,打开任意游戏,按Shift+Tab,点击进入内置浏览器,在chrome://settings的安全中加入后缀名从cer改成pem的证书
7. 应用配置
7.1 大写锁定映射为Ctrl
- 编辑/etc/udev/hwdb.d/99-caps-ctrl.hwdb,添加:
evdev:atkbd:dmi:bvn*:bvr*:bd*:svn*:pn*:pvr* KEYBOARD_KEY_3a=leftctrl- 生效:
sudosystemd-hwdb updatesudoudevadm trigger7.2 浏览器配置
在Firefox中调整语言偏好
修改下载目录至所需位置
7.3 主题与鼠标指针
将桌面环境各组件统一更换为Catppuccin主题
下载鼠标主题Colloid cursors并解压到~/.local/share/icons/
7.4 Neovim配置
- 在Neovim中安装treesitter解析器:
:TSInstall cpp html latex yaml7.5 微信沙盒配置
- 创建共享目录用于文件传输:
mkdir-p~/wechat-shared- 查找沙盒启动脚本:
ls/usr/bin/wechat*- 编辑脚本(例如/usr/bin/wechat-universal),在exec bwrap与/opt/wechat/wechat "$@"之间插入一行:
--bind /home/tistath/wechat-shared /home/tistath/wechat-shared其他配置文件
- 我的仓库
包
| 内核固件 | 说明 |
|---|---|
| linux | 内核本体 |
| linux-firmware | 必需固件集合 |
| amd-ucode | 微码,管理CPU |
| tlp | 电源管理 |
| brightnessctl | 亮度调节 |
| 基础系统 | 说明 |
|---|---|
| base | 最小系统环境 |
| base-devel | 编译环境 |
| btrfs-progs | BTRFS文件系统管理工具 |
| efibootmgr | UEFI启动项管理 |
| man-db | 命令手册 |
| pacman-contrib | pacman清理工具 |
| networkmanager | 网络管理 |
| git | 版本管理 |
| 系统维护 | 说明 |
|---|---|
| snapper | 快照工具 |
| snap-pac | 自动创建快照 |
| 桌面环境 | 说明 |
|---|---|
| niri | 窗口管理器 |
| xwayland-satellite | 兼容X11应用 |
| waybar | 状态栏 |
| swaybg | 壁纸 |
| swayidle | 锁屏 |
| swaylock-effects | 屏保 |
| mako | 消息通知 |
| libnotify | 桌面通知库,mako依赖 |
| mate-polkit | 图形应用提权 |
| wl-clipboard | 底层剪切板 |
| copyq | 图形化高级剪切板 |
| 命令行工具 | 说明 |
|---|---|
| kitty | 终端 |
| fish | shell |
| fastfetch | 系统信息展示 |
| tree | 文件结构显示 |
| rsync | 高效复制 |
| pastel | 颜色显示工具 |
| chafa | 图片查看工具 |
| AUR | 说明 |
|---|---|
| archlinuxcn-keyring | 仓库密钥 |
| yay | AUR助手 |
| 开发工具 | 说明 |
|---|---|
| neovim | 文本编辑器 |
| tree-sitter-cli | 语法树解析,treesitter依赖 |
| ripgrep | 高速文本搜索,telescope依赖 |
| clang | C/C++前后端 |
| 多媒体 | 说明 |
|---|---|
| gst-libav | 音视频编解码插件 |
| gst-plugins-base | 音视频编解码插件 |
| gst-plugins-good | 音视频编解码插件 |
| libva-utils | 硬件加速管理 |
| 浏览器 | 说明 |
|---|---|
| firefox | 火狐浏览器 |
| gnome-keyring | 密码管理 |
| torbrowser-launcher | 洋葱浏览器 |
| 加速器 | 说明 |
|---|---|
| watt-toolkit-bin | 加速github,steam等 |
| 文档查看 | 说明 |
|---|---|
| zathura | PDF查看工具 |
| zathura-pdf-mupdf | PDF渲染后端 |
| tesseract-data-eng | PDF英文语言包 |
| tesseract-data-chi_sim | PDF中文语言包 |
| 字体 | 说明 |
|---|---|
| adobe-source-han-sans-otc-fonts | 思源黑体,简繁日韩字体 |
| ttf-jetbrains-mono-nerd | Jetbrains mono nerd font,英文字体及图标 |
| 输入法 | 说明 |
|---|---|
| fcitx5 | 输入法 |
| fcitx5-rime | *中州韵,桥接中文输入法 |
| fcitx5-configtool | 输入法配置工具 |
| fcitx5-gtk | 使输入法在GTK中可用 |
| fcitx5-qt | 使输入法在QT中可用 |
| rime-ice-pinyin-git | 雾凇拼音 |
| 游戏 | 说明 |
|---|---|
| steam | 游戏平台 |
| 社交 | 说明 |
|---|---|
| linuxqq | |
| wechat-universal-bwrap | 隐私版微信 |