Arch Linux环境配置指南
本教程将指导你完成 Arch Linux 的环境配置过程。
目录
1. 系统基础配置
1.1 系统源配置
添加国内源
在开头添加以下内容 1
2
3
4
5
6
7sudo vim /etc/pacman.d/mirrorlist
# 清华大学
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
# 163
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
# 阿里云
Server = http://mirrors.aliyun.com/archlinux/$repo/os/$arch
添加 archlinuxcn 源与 multilib 支持
在最后添加以下内容 1
2
3
4
5
6
7sudo vim /etc/pacman.conf
[archlinuxcn]
# The Chinese Arch Linux communities packages.
SigLevel = Optional TrustAll
# 清华大学源
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
安装密钥环
1 | sudo pacman -Syu && sudo pacman -S archlinuxcn-keyring |
1.2 系统更新与包管理
系统更新
1 | sudo pacman -Syu |
安装 AUR 助手
1 | sudo pacman -S paru |
提示:建议使用 paru 替代 pacman 安装软件包
1.3 显示服务配置
安装显示服务
1 | paru -S xorg |
安装显卡驱动
根据显卡类型选择安装:
AMD 显卡:
1
paru -S xf86-video-amdgpu
NVIDIA 显卡:
1
paru -S nvidia nvidia-utils
NVIDIA 深度学习环境:
1
paru -S cuda
安装显示管理器
1 | paru -S sddm |
2. 桌面环境配置
2.1 桌面环境选择
根据需求选择合适的桌面环境:
KDE Plasma:功能丰富,美观现代
1
paru -S plasma kde-applications packagekit-qt5
Xfce:轻量级桌面环境
1
paru -S xfce4 xfce4-goodies
i3wm:平铺式窗口管理器
1
paru -S i3
注意:安装完桌面环境后需要重启系统
2.2 中文环境配置
安装中文字体
1 | paru -S ttf-sarasa-gothic noto-fonts-cjk |
2.3 输入法配置
Fcitx5 输入法(推荐)
1 | sudo pacman -S fcitx5-im fcitx5-chinese-addons fcitx5-pinyin-zhwiki fcitx5-material-color fcitx5-nord |
配置环境变量: 1
2
3
4
5# 编辑 /etc/environment 添加:
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
SDL_IM_MODULE=fcitx
配置自动启动(按顺序尝试): 1. XDG
桌面环境(KDE/GNOME/Xfce)默认自启 2. 创建
~/.config/autostart/fcitx-autostart.desktop 3. i3wm
配置文件添加:exec_always --no-startup-id fcitx5
Fcitx4 输入法(i3wm 备选方案)
1 | paru -S fcitx-im fcitx-rime |
环境变量配置同
Fcitx5,将启动命令改为:exec_always --no-startup-id fcitx
3. 常用软件安装
3.1 开发工具
1 | paru -S visual-studio-code-bin # VS Code |
3.2 办公软件
1 | # 办公套件 |
3.3 多媒体软件
1 | paru -S obs-studio # 录屏工具 |
3.4 系统工具
1 | paru -S timeshift # 系统备份 |
4. 系统优化
4.1 远程控制配置
向日葵配置
1 | systemctl start runsunloginclient # 启动服务 |
花生壳内网穿透
1 | paru -S phddns-bin |
添加以下内容: 1
2
3
4
5
6
7
8
9
10
11
12
13[Unit]
Description=phddns Service
Wants=network-online.target
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/phddns start
StandardOutput=syslog
StandardError=null
[Install]
WantedBy=multi-user.target1
2systemctl start phddns.service
systemctl enable phddns.service
4.2 系统时钟同步
Windows 双系统时间同步
在 Windows PowerShell(管理员)中执行: 1
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_QWORD /f
4.3 代理配置
终端代理设置
1 | # 临时代理 |
添加到 ~/.zshrc 实现快捷切换 1
2alias setproxy="export http_proxy=http://127.0.0.1:7890 && export https_proxy=http://127.0.0.1:7890"
alias unproxy="unset http_proxy https_proxy"
方式2(脚本配置)
参考该项目介绍abel的个人配置