虽然Windows很强大,但难免有时还是要了解、学习、使用,甚至依赖Linux系统,从Windows 10起,微软也开始拥抱Linux,对于普通用户来说是一件很好的事情,可以减体育少时间和精力成本,让普通用户很容易学习和接受Linux。
本文主要从普通用户的角度来演示一下如何在Windows 11安装Linux子系统。
以管理员身份运行命令行
1、升级更新wsl内核版本
wsl --update
2、查看有效分发的列表
wsl --list -o
C:\WINDOWS\system32>wsl --list -o以下是可安装的有效分发的列表。请使用“wsl --install -d <分发>”安装。NAME FRIENDLY NAMEUbuntu UbuntuDebian Debian GNU/Linuxkali-linux Kali Linux RollingopenSUSE-42 openSUSE Leap 42SLES-12 SUSE Linux Enterprise Server v12Ubuntu-16.04 Ubuntu 16.04 LTSUbuntu-18.04 Ubuntu 18.04 LTSUbuntu-20.04 Ubuntu 20.04 LTS
3、安装
C:\WINDOWS\system32>wsl --install -d Ubuntu-20.04
正在下载: Ubuntu 20.04 LTS[= 3.3% ] C:\WINDOWS\system32>wsl --install -d Ubuntu-20.04正在下载: Ubuntu 20.04 LTS安装过程中出现错误。分发名称: 'Ubuntu 20.04 LTS' 错误代码: 0x80072eff
安装下载中
##换个分发名称再安装C:\WINDOWS\system32>wsl --install -d ubuntu正在下载: Ubuntu正在安装: Ubuntu已安装 Ubuntu。正在启动 Ubuntu…
输入用户名和密码:
体育安装成功
3.1、设置root用户密码youufis@LiuYuJun-K3:~$ sudo passwd rootNew password:Retype new password:passwd: password updated successfully
3.2、查看网络配置
youufis@LiuYuJun-K3:~$ ifconfigCommand 'ifconfig' not found, but can be installed with:sudo apt install net-toolsyouufis@LiuYuJun-K3:~$ sudo apt install net-toolsReading package lists... DoneBuilding dependency treeReading state information... DoneThe following NEW packages will be installed: net-tools0 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 4s (54.4 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) ...youufis@LiuYuJun-K3:~$
youufis@LiuYuJun-K3:~$ ifconfigeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.26.158.186 netmask 255.255.240.0 broadcast 172.26.159.255 inet6 fe80::215:5dff:fe6e:50ca prefixlen 64 scopeid 0x20<link> ether 00:15:5d:6e:50:ca txqueuelen 1000 (Ethernet) RX packets 208 bytes 245306 (245.3 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 129 bytes 10858 (10.8 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (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 0youufis@LiuYuJun-K3:~$
##检查网络连通性,ping一个百度youufis@LiuYuJun-K3:~$ ping www.baidu.comPING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=55 time=11.5 ms64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=2 ttl=55 time=9.09 ms64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=55 time=8.71 ms64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=55 time=9.29 ms64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=5 ttl=55 time=8.87 ms64 bytes from 14.215.177.38 (14.215.177.38): icmp_seq=6 ttl=55 time=8.87 ms^C--- www.a.shifen.com ping statistics ---6 packets transmitted, 6 received, 0% packet loss, time 9068msrtt min/avg/max/mdev = 8.711/9.395/11.548/0.980 ms
4、安装完毕,启动ubuntu
#管理员身份运行CMDC:\WINDOWS\system32>wslyouufis@LiuYuJun-K3:/mnt/c/WINDOWS/system32$
至此,可以在Linux系统下折腾和学习了。
平台