勾選Windows子系統Linux版
> wsl --install
顯示無法安裝,可以試試下面指令
> wsl --list --online
以下是可安裝之有效發佈的清單。
使用 'wsl --install -d <Distro>' 安裝。
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
在此,選擇 Ubuntu-20.04
ryan@LAPTOP-ARBQPL75:~$ whoami
ryan
ryan@LAPTOP-ARBQPL75:~$ ifconfig
Command 'ifconfig' not found, but can be installed with:
sudo apt install net-tools
ryan@LAPTOP-ARBQPL75:~$ sudo apt install net-tools
[sudo] password for ryan:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
net-tools
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 196 kB of archives.
After this operation, 864 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 net-tools amd64 1.60+git20180626.aebd88e-1ubuntu1 [196 kB]
Fetched 196 kB in 2s (82.0 kB/s)
Selecting previously unselected package net-tools.
(Reading database ... 31836 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.deb ...
Unpacking net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Setting up net-tools (1.60+git20180626.aebd88e-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
ryan@LAPTOP-ARBQPL75:~$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 1500
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0xfe<compat,link,site,host>
loop (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.20.10.3 netmask 255.255.255.240 broadcast 172.20.10.15
inet6 fe80::3cf3:c3e8:405a:1fac prefixlen 64 scopeid 0xfd<compat,link,site,host>
ether c0:e4:34:27:c6:7b (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
更新和升級套件
>sudo apt update && sudo apt upgrade
確認版本
步驟 1 - 啟用 Windows 子系統 Linux 版
> dism.exe /online / enable-feature /featurename: Microsoft-Windows - Subsystem-Linux /all /norestart
步驟 2 - 檢查執行 WSL 2 的需求
低於 18362 的組建不支援 WSL 2
步驟 3 - 啟用虛擬機器功能
在安裝 WSL 2 之前,您必須啟用虛擬機器平台選用功能。 您的電腦需要 虛擬化功能 才能使用這項功能。
以系統管理員身分開啟 PowerShell 並執行:
> dism.exe /online / enable-feature /featurename:VirtualMachinePlatform /all /norestart
步驟 4 - 下載 Linux 核心更新套件
-
下載最新套件:
切換到 WSL2
> wsl --set-version Ubuntu-20.04 2
切換到 WSL
> wsl --set-version Ubuntu-20.04 1
參考資料:
How to Install and Use the Linux Bash Shell on Windows 10
使用 WSL 在 Windows 上安裝 Linux
WSL2: Code faster on the Windows Subsystem for Linux! | Tabs vs Spaces
留言列表