在Windows下安装Arch Linux子系统

操作依赖于项目 ArchWSL

  1. 下载zip包:https://github.com/yuk7/ArchWSL/releases/tag/18081100
  2. 解压到特定目录(需要有写入权限)作为安装目录
  3. 运行Arch.exe,开始部署环境
  4. 等待部署完成
  5. 再次运行Arch.exe,并执行代码
[root@PC-NAME user]# pacman-key --init
[root@PC-NAME user]# pacman-key --populate

将其设置为默认WSL终端
在PowerShell中执行

wslconfig /s Arch

这样就可以在Windows下直接运行Arch Linux了

初始化配置脚本

useradd -d /home/ohyee -m ohyee
echo "ohyee ALL=(ALL) ALL" >> /etc/sudoers.d/ohyee
sed -i '1i\Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/\$repo/os/\$arch' /etc/pacman.d/mirrorlist
echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
echo -e "[archlinuxcn]\nServer = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/\$arch" >> /etc/pacman.conf
pacman-key --init
pacman-key --populate
pacman -Syyu archlinuxcn-keyring --noconfirm
pacman -S yay --noconfirm
pacman -S zsh --noconfirm

ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5

# 链接 Windows 字体
ln -s /mnt/c/Windows/Fonts /usr/share/fonts/WindowsFonts
fc-cache -f

chsh  -s /usr/bin/zsh ohyee
passwd ohyee
su ohyee