Skip to content

Latest commit

 

History

History
112 lines (79 loc) · 1.7 KB

ubuntu_wsl.md

File metadata and controls

112 lines (79 loc) · 1.7 KB
date author title url tags categories toc draft
2022-05-02 12:19:52 +0800
Rustle Karl
Ubuntu WSL 问题笔记
posts/linux/quickstart/install/ubuntu_wsl
Linux
Linux 学习笔记
true
false

设置 WSL 默认 root 用户

ubuntu config --default-user root
kali config --default-user root
ubuntu2004 config --default-user root

系统更新

sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

sudo sed -i 's/mirrors.ustc.edu.cn/archive.ubuntu.com/g' /etc/apt/sources.list

apt update && apt upgrade -y

WSL1 转换为 WSL2

wsl.exe -l -v
wsl.exe --set-default-version 2
wsl.exe --set-version ubuntu 2

修改 hostname

https://www.srccodes.com/change-hostname-ubuntu-microsoft-windows-subsystem-for-linux-wsl-wsl2-wsl-conf-unable-resolve-hosts-name-service-not-known-list-running-shutdown-vm-srccodes/

默认情况跟宿主机是一样的,看着很难受。

vim /etc/wsl.conf
vi /etc/wsl.conf
[network]
hostname = ubuntu-wsl
generateHosts = false
[network]
hostname = kali-wsl
generateHosts = false
wsl --shutdown

升级大版本

apt update && apt upgrade -y

do-release-upgrade 指令可以帮助我们升级 Ubuntu 版本,但是如果直接运行,会提醒没有更新的版本,这时我们就需要

do-release-upgrade -d
lsb_release -a

WSL2 GUI 测试

apt install gedit -y

gedit ~/.bashrc

分辨率不匹配,基本用不了。

卸载重启检测

apt purge needrestart