WSL2 安装配置
WSL2 安装配置
woioeow安装 WSL2
- 启用适用于 Linux 的 Windows 子系统
1 | dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart |
- 启用虚拟化
1 | dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart |
- 启动 Hyper-V
Windows+R 键,调出运行,键入 control,进入控制面板,进入程序,打开启动或关闭 Windows 功能,勾选 Hyper-V,重启
设置 WSL 默认版本
wsl --set-default-version 2
安装 Linux
打开 Store 商店,输入 Arch,下载
下载完了,打开,输入用户名,密码
配置 Arch
换源
切换 Arch linux、Arch linux CN 源
1 | sudo pacman -Syyuu |
下载 nvim、zsh & ohmyzsh、yay
1 | cat /etc/shells # 查看 zsh 是否安装 |
zsh & ohmyzsh
ohmyzsh 安装:
- 把 oh-my-zsh 项目 Clone 下来:
1 | git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh |
- 复制 .zshrc
1 | cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc |
- 更改你的默认 Shell
1 | chsh -s /bin/zsh |
zsh 插件:
powerlevel10k(主题)
1
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
把。zshrc 打开,找到 ZSH_THEME,把值改为 “powerlevel10k/powerlevel10k”
auto-suggestion(自动补全)
1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
把。zshrc 打开,找到 plugins=(git),在 git 后面添加 zsh-autosuggestions
syntax highlighting(语法高亮)
1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
把
.zshrc打开,找到plugins=(git),在git后面添加zsh-syntax-highlighting
最后 source ~/.zshrc
nvim
1 | sudo pacman -S neovim |
nano 编辑器
Ctrl+O: 保存,按 回车 保存当前文件
Ctrl+X: 退出
迁移 WSL2
1 | wsl --shutdown #关闭所有正在运行的实例 |