效果图预览

安装WSL2

下载发行版

下载Nerd Font字体

安装arch

  • 解压压缩包,双击打开Arch.exe。完成后退出再次打开即可。

配置用户

  • 设置root用户密码
1
passwd 
  • 添加用户组
1
echo "%wheel ALL=(ALL) ALL" > /etc/sudoers.d/wheel
  • 添加用户
1
useradd -m -G wheel -s /bin/bash {UserName} #{UserName}替换为用户名
  • 设置用户密码
1
passwd {UserName} #{UserName}替换为用户名
  • 设置默认登录用户
    • 在目录位置打开终端(存放Arch的目录)
1
.\Arch.exe config --default-user {UserName} #{UserName}替换为用户名

初始化密钥环

  • 依次执行
1
2
3
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman -Syy archlinux-keyring

卸载Arch

  • 在目录中打开pwsh
1
.\Arch.exe --clean

换源

  • 编辑/etc/pacman.d/mirrorlist文件,在头部加入以下内容
  • 可使用sudo nano /etc/pacman.d/mirrorlist编辑文件,Ctrl+S,Ctrl+X保存并退出。
1
2
3
4
5
6
# 华为镜像站
Server = https://repo.huaweicloud.com/archlinux/$repo/os/$arch
# 阿里镜像站
Server = https://mirrors.aliyun.com/archlinux/$repo/os/$arch
# 清华镜像站
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
  • sudo nano /etc/pacman.conf添加archlinuxcn
1
2
3
4
5
[archlinuxcn]
# 阿里archlinuxcn源
Server = https://mirrors.aliyun.com/archlinuxcn/$arch
# 清华archlinuxcn源
# Server = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
  • 更新
1
2
sudo pacman -Suyy
sudo pacman -S archlinuxcn-keyring

本地化

  • 进入文件取消注释en_US.UTF-8 UTF-8 和 zh_CN.UTF-8 UTF-8
1
sudo nano /etc/locale.gen
  • 更新
1
locale-gen
  • 设置时区
1
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

安装yay

1
sudo pacman -S yay

一些基本软件安装更新

1
2
sudo pacman -S git
sudo pacman -S neovim yay zsh fastfetch
1
sudo pacman -Syyu base base-devel git zip unzip net-tools tree python wget btop fastfetch --needed --noconfirm
  • 如果后续安装软件包缺少依赖, 可以临时注释掉/etc/pacman.conf中所有后缀为testingstaging的软件源, 完成后使用sudo pacman -Syyu更新依赖即可.

安装 vs code

1
sudo pacman -S code

git clone 加速

1
git config --global url."https://gitclone.com/".insteadOf https://
  • 取消更改
1
git config --global --unset url.https://gitclone.com/.insteadOf
  • 或者进入配置文件删除
1
sudo nano .gitconfig

c++环境

  • g++安装
1
sudo pacman -S gcc
  • gdb安装
1
sudo pacman -S gdb
  • cmake安装
1
yay -S cmake
  • 然后在vscode下下载对应的扩展即可

    • WSL,C/C++,Code Runner
  • 到这里已经可以在windos下的vs code远程连接arch进行开发了。

npm换国内源

  • 华为云
1
npm config set registry https://mirrors.huaweicloud.com/repository/npm/

安装文件管理器YAZI

1
sudo pacman -S yazi ffmpegthumbnailer unarchiver jq poppler fd ripgrep fzf zoxide

更换yazi主题

安装lsd(替代ls的包)

1
sudo pacman -S lsd
  • 用法
    • lsd
    • lsd -a
    • lsd -l
    • lsd --tree

终端美化oh-my-zsh

  • 安装oh-my-zsh
1
2
git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
  • 设置主题(powerlevel10k)
  • 安装主题
1
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  • 设置主题
1
2
3
sudo nano ~/.zshrc
# 找到并替换为下面的值
ZSH_THEME="powerlevel10k/powerlevel10k"
  • 更改默认终端
1
2
3
4
sudo chsh -s /bin/zsh  #root用户终端
sudo chsh -s /bin/zsh {username} #非roo用户
# {username} 替换为实际用户名
zsh # 切换终端
  • 配置p10k
1
source ~/.zshrc # 启动配置
  • 然后根据向导配置即可

配置nvim

  • 安装nvim
1
sudo pacman -S neovim
  • 配置Astrovim
  • 清理原有配置
1
2
3
mv ~/.local/share/nvim ~/.local/share/nvim.bak
mv ~/.local/state/nvim ~/.local/state/nvim.bak
mv ~/.cache/nvim ~/.cache/nvim.bak
  • 克隆仓库,打开更新
1
2
3
git clone --depth 1 https://github.com/AstroNvim/template ~/.config/nvim
rm -rf ~/.config/nvim/.git
nvim