参考
https://docs.microsoft.com/zh-cn/windows/wsl/install
https://docs.microsoft.com/zh-cn/windows/wsl/setup/environment
打开管理员 PowerShell输入此命令
wsl --list --online
wsl --install -d Ubuntu-20.04
PS C:\WINDOWS\system32> wsl --list --online
以下是可安装的有效分发的列表。
请使用“wsl --install -d <分发>”安装。
NAME FRIENDLY NAME
Ubuntu Ubuntu
Debian Debian GNU/Linux
kali-linux Kali Linux Rolling
openSUSE-42 openSUSE Leap 42
SLES-12 SUSE Linux Enterprise Server v12
Ubuntu-16.04 Ubuntu 16.04 LTS
Ubuntu-18.04 Ubuntu 18.04 LTS
Ubuntu-20.04 Ubuntu 20.04 LTS
PS C:\WINDOWS\system32> wsl --install -d Ubuntu-20.04
正在下载: Ubuntu 20.04 LTS
正在安装: Ubuntu 20.04 LTS
已安装 Ubuntu 20.04 LTS。
正在启动 Ubuntu 20.04 LTS…
WSL自动启动
输入账号和密码
手动更新sudo apt update
手动更新apt list --upgradable
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: season
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sun Aug 28 12:03:17 CST 2022
System load: 0.52 Processes: 7
Usage of /home: unknown Users logged in: 0
Memory usage: 82% IPv4 address for eth1: 172.21.16.1
Swap usage: 1% IPv4 address for wifi0: 192.168.31.237
0 updates can be installed immediately.
0 of these updates are security updates.
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
This message is shown once once a day. To disable it please create the
/home/season/.hushlogin file.
season@DESKTOP-25N1E20:~$ sudo apt update
278 packages can be upgraded. Run 'apt list --upgradable' to see them.
season@DESKTOP-25N1E20:~$ apt list --upgradable
检查正在运行的 WSL 版本
wsl -l -v
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* docker-desktop-data Running 2
docker-desktop Running 2
Ubuntu-20.04 Running 1
VS code打开WSL
WSL文件夹可以在windows中访问。
将WSL1升级到WSL2
wsl --set-version Ubuntu-20.04 2
Ubuntu-20.04 Running 1
PS C:\WINDOWS\system32> wsl --set-version Ubuntu-20.04 2
正在进行转换,这可能需要几分钟时间...
有关与 WSL 2 的主要区别的信息,请访问 https://aka.ms/wsl2
转换完成。
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* docker-desktop-data Running 2
docker-desktop Running 2
Ubuntu-20.04 Stopped 2
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* docker-desktop-data Running 2
docker-desktop Running 2
Ubuntu-20.04 Running 2
安装docker
-
安装docker请看官方文档
https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository -
以非 root 用户身份管理 Docker
https://docs.docker.com/engine/install/linux-postinstall/
启动docker
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
sudo service docker start
运行docker命令
docker pull seasonzhang/gaga_meeting:0.9.1
docker run --name gaga_meeting -p 8000:8000 seasonzhang/gaga_meeting:0.9.1
成功进入django debug模式