Arch Linux 安装指南:从系统构建到图形环境
🛠 Arch Linux 安装指南
Section titled “🛠 Arch Linux 安装指南”欢迎来到 Arch Linux 的世界。本手册将带你完成从基础系统联网、分区到安装图形界面(GUI)及常用软件的全过程。
1. 环境准备与联网
Section titled “1. 环境准备与联网”在启动后的 Live 环境中,首先需要确保网络通畅。
# 1. 如果是无线网络,使用 iwd 联网iwctl # 进入交互式联网工具# 在 iwctl 界面中依次执行:# station wlan0 scan # 扫描网络# station wlan0 get-networks # 列出可用网络# station wlan0 connect <SSID> # 连接 WiFi# quit # 退出工具
# 2. 检查网络连通性ping -c 4 google.com # 发送 4 个 ICMP 包测试网络
# 3. 更新系统时间(防止证书校验失败)timedatectl set-ntp true # 开启网络时间同步2. 磁盘分区与格式化
Section titled “2. 磁盘分区与格式化”我们将采用主流的 UEFI + GPT 结构。
2.1 分区规划
Section titled “2.1 分区规划”使用 cfdisk 工具进行可视化操作:
cfdisk /dev/nvme0n1 # 打开磁盘分区工具# 选择 Label 类型为: gpt# 分区 1: 512M -> 类型选择 EFI System# 分区 2: 剩余空间 -> 类型选择 Linux filesystem# 点击 Write 写入更改,然后 Quit 退出2.2 格式化与挂载
Section titled “2.2 格式化与挂载”# 格式化分区mkfs.fat -F 32 /dev/nvme0n1p1 # EFI 分区mkfs.ext4 /dev/nvme0n1p2 # 根分区
# 挂载分区mount /dev/nvme0n1p2 /mnt # 先挂载根目录mkdir -p /mnt/boot # 创建 EFI 挂载点mount /dev/nvme0n1p1 /mnt/boot # 挂载 EFI 分区3. 系统安装与基础配置
Section titled “3. 系统安装与基础配置”3.1 安装核心包
Section titled “3.1 安装核心包”# 优化镜像源(中国区)reflector --country China --protocol https --sort rate --save /etc/pacman.d/mirrorlist
# 安装基础系统pacstrap /mnt base linux linux-firmware base-devel networkmanager vim3.2 系统初始化
Section titled “3.2 系统初始化”# 生成挂载表genfstab -U /mnt >> /mnt/etc/fstab
# 进入新系统 (Chroot)arch-chroot /mnt
# 设置时区与本地化ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtimehwclock --systohc# 编辑 /etc/locale.gen 取消 en_US.UTF-8 注释,然后运行:locale-genecho "LANG=en_US.UTF-8" > /etc/locale.conf
# 用户与权限echo "my-arch" > /etc/hostname # 设置主机名passwd # 设置 root 密码useradd -m -G wheel myuser # 创建普通用户passwd myuser# 使用 visudo 取消 %wheel ALL=(ALL:ALL) ALL 的注释3.3 引导程序 (GRUB)
Section titled “3.3 引导程序 (GRUB)”pacman -S grub efibootmgrgrub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCHgrub-mkconfig -o /boot/grub/grub.cfg🖥 4. 图形桌面环境安装 (KDE Plasma)
Section titled “🖥 4. 图形桌面环境安装 (KDE Plasma)”完成基础系统后,我们需要安装显示驱动和桌面环境。
# 1. 安装显卡驱动(根据你的显卡选择)# 英特尔: pacman -S mesa lib32-mesa vulkan-intel# AMD: pacman -S mesa lib32-mesa xf86-video-amdgpu# 英伟达: pacman -S nvidia nvidia-utilspacman -S mesa # 通用开源驱动
# 2. 安装 Xorg 和 字体pacman -S xorg ttf-dejavu wqy-microhei # 包含中文字体防止乱码
# 3. 安装 KDE Plasma 核心组件pacman -S plasma-desktop sddm konsole dolphin# 解释:# plasma-desktop: 桌面核心# sddm: 登录管理器 (显示管理器)# konsole: 终端# dolphin: 文件管理器
# 4. 启用服务(开机进入图形界面)systemctl enable sddmsystemctl enable NetworkManager🚀 5. 推荐软件清单
Section titled “🚀 5. 推荐软件清单”系统装好后,建议安装以下生产力工具。
5.1 基础必装
Section titled “5.1 基础必装”| 软件名 | 用途 | 安装命令 |
|---|---|---|
| Google Chrome | 网页浏览器 | yay -S google-chrome |
| VS Code | 代码编辑器 | sudo pacman -S code |
| Git | 版本控制 | sudo pacman -S git |
| Fastfetch | 系统信息展示 | sudo pacman -S fastfetch |
5.2 系统维护
Section titled “5.2 系统维护”- Yay: AUR 助手(必装)。
- Timeshift: 系统快照(防止滚挂)。
- Btop: 实时资源监视器。
5.3 生产力与多媒体
Section titled “5.3 生产力与多媒体”- Typora: Markdown 编辑器。
- VLC: 全能播放器。
- Telegram Desktop: 通讯工具。
- YesPlayMusic: 高颜值网易云客户端。
6. 完成安装
Section titled “6. 完成安装”exit # 退出 chrootumount -R /mnt # 卸载分区reboot # 重启进入新世界