WSL

前置条件

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

设置root密码

sudo passwd

设置sudo免输密码

# 使用root账户登录
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

安装apt包

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

## optional
sudo apt install atop htop iotop iostat nmon
sudo apt install strace ltrace
sudo apt install valgrind
sudo apt install linux-tools-common linux-tools-"$(uname -r)"
sudo apt install linux-cloud-tools-common linux-cloud-tools-"$(uname -r)"
sudo apt install linux-tools-generic linux-cloud-tools-generic

生成ssh-key

ssh-keygen -t rsa

git配置

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

sudo apt-get install gnutls-bin
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000

安装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
nvm current
npm -v

安装npm包

npm install -g @openai/codex

npm install -g @anthropic-ai/claude-code

npm install -g @musistudio/claude-code-router

npm install -g @google/gemini-cli

安装gem包

sudo gem install jekyll jekyll-paginate

oh-my-zsh

## zsh
sudo apt install zsh

## 不要加sudo!!!
chsh -s /bin/zsh

## oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

## powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"

## edit ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"

## plugins
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
plugins=(git vscode zsh-autosuggestions zsh-syntax-highlighting)

## ll
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

移除snapd

sudo apt remove --purge --autoremove snapd
sudo apt-mark hold snapd

sudo apt update
rm -rf ~/snap/
sudo rm -rf /snap/
sudo rm -rf /var/cache/snapd/
sudo rm -rf /var/lib/snapd/

安装uv

curl -LsSf https://astral.sh/uv/install.sh | sh

安装superfile

bash -c "$(curl -sLo- https://superfile.dev/install.sh)"

安装pwndbg

curl -qsL 'https://install.pwndbg.re' | sh -s -- -t pwndbg-gdb

curl -qsL 'https://install.pwndbg.re' | sh -s -- -t pwndbg-lldb

安装minicoda

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