问题:安装 WSL2 Ubuntu 卡在 0%(也可以试试商店安装有没有速度):

到这里下载离线安装包:https://learn.microsoft.com/en-us/windows/wsl/install-manual
复制地址到迅雷下载,它有自己的缓存,所以国内速度也很快:

双击安装即可,和命令行或者商店安装的效果一样。

我的网盘备份:https://alist.hqy.life/public/WSL2
修改 /etc/apt/sources.list,具体看各个镜像源的说明文档,记得要和自己的版本对应,这里的20.04代号是 focal,例如https://developer.aliyun.com/mirror/ubuntu,修改后更新下:
sudo apt update
sudo apt upgrade
sudo passwd root # 别忘了 sudo
PS C:\\Users\\yongq> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 2
PS C:\\Users\\yongq> wsl --export Ubuntu D:\\Ubuntu_WSL\\Ubuntu.tar
正在导出,这可能需要几分钟时间。
操作成功完成。
PS C:\\Users\\yongq> wsl --unregister Ubuntu
正在注销。
操作成功完成。
PS C:\\Users\\yongq> wsl --import Ubuntu D:\\Ubuntu_WSL D:\\Ubuntu_WSL\\Ubuntu.tar
正在导入,这可能需要几分钟时间。
操作成功完成。
PS C:\\Users\\yongq> ubuntu config --default-user cyang
PS C:\\Users\\yongq> ubuntu
cyang@yy-202308:~$
具体参考:https://zhuanlan.zhihu.com/p/621873601,备份文件 tar 可以删除掉

cyang@yy-202308:~$ sudo apt autoremove openssh-server
cyang@yy-202308:~$ sudo apt install openssh-server
cyang@yy-202308:~$ sudo vi /etc/ssh/sshd_config
cyang@yy-202308:~$ sudo service ssh restart
* Restarting OpenBSD Secure Shell server sshd [ OK ]
cyang@yy-202308:~$ ps aux | grep sshd
root 460 0.0 0.0 12192 3072 ? Ss 16:59 0:00 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups
cyang 464 0.0 0.0 8168 720 pts/0 S+ 16:59 0:00 grep --color=auto sshd