windows 10+ 安装 wsl ubuntu
wsl --install -d Ubuntu-22.04
确定检查 Ubuntu 版本的方法:
lsb_release -a(标准且最常用)。cat /etc/os-release(标准文件,包含详细信息)。hostnamectl(在完整 Ubuntu 上有效,但在 WSL 中可能受限或不显示相同信息,不过仍然可用)。uname -a(仅显示内核版本,而非发行版版本——对他们帮助不大,或许应提及但区分开来)。/etc/issue或/etc/ubuntu-release(旧式文件,但仍可能存在)。
ubantu配置国内镜像:
复制一份 原配置 备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
清华镜像
sudo tee /etc/apt/sources.list << 'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
EOF
更新软件包:
sudo apt update sudo apt upgrade -y