WSL

前置条件

  • 开启BIOS虚拟化
  • 可选功能中开启Hyper-V和WSL
  • powershell管理员模式下执行bcdedit /set hypervisorlaunchtype auto
wsl --set-default-version 2
wsl --update
wsl --list --online
wsl --install -d Ubuntu-24.04

设置root密码

sudo passwd

设置sudo免输密码

# 使用root账户登录
passwd username
chmod u+w /etc/sudoers
echo "username ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
chmod u-w /etc/sudoers

替换apt源

# 备份
cd /etc/apt/sources.list.d
sudo cp ubuntu.sources ubuntu.sources.bak

# 修改ubuntu.sources
Types: deb
URIs: http://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# 更新
sudo apt update
sudo apt upgrade

生成ssh-key

ssh-keygen

git配置

git config --global user.name "username"
git config --global user.email "email"

安装apt包

sudo apt install build-essential nasm yasm cmake gdb pkg-config python3 ruby vim cloc tree zip neofetch net-tools
sudo apt install llvm lldb clang-format clang-tidy

安装node.js

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
\. "$HOME/.nvm/nvm.sh"
nvm install 24
node -v # Should print "v24.5.0".
nvm current # Should print "v24.5.0".
npm -v # Should print "11.5.1".

安装minicoda

参考这篇教程: miniconda安装及使用