虽然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 NAME Ubuntu Ubuntu Debian Debian GNU/Linux kali-linux Kali Linux Rolling openSUSE-42 openSUSE Leap 42 SLES-12 SUSE Linux Enterprise Server v12 Ubun Ubuntu 16.04 LTS Ubun Ubuntu 18.04 LTS Ubun Ubuntu 20.04 LTS
3、安装
C:\WINDOWS\system32>wsl --install -d Ubun
正在下载: Ubuntu 20.04 LTS [= 3.3% ] C:\WINDOWS\system32>wsl --install -d Ubun 正在下载: 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 root New password: Retype new password: passwd: password updated successfully
- 3.2、查看网络配置
youufis@LiuYuJun-K3:~$ ifconfig Command 'ifconfig' not found, but can be installed with: sudo apt install net-tools youufis@LiuYuJun-K3:~$ sudo apt install net-tools 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 focal/main amd64 net-tools amd64 1.60+gi [196 kB] Fetched 196 kB in 4s kB/s) Selecting previously unselected package net-tools. (Reading database ... 31836 files and directories currently installed.) Preparing to unpack .../net-tools_1.60+gi_amd64.deb ... Unpacking net-tools (1.60+gi) ... Setting up net-tools (1.60+gi) ... Processing triggers for man-db ) ... youufis@LiuYuJun-K3:~$
youufis@LiuYuJun-K3:~$ ifconfig eth0: 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 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 129 bytes 10858 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: 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 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 youufis@LiuYuJun-K3:~$
##检查网络连通性,ping一个百度 youufis@LiuYuJun-K3:~$ ping www.baidu.com PING www.a. ) 56(84) bytes of data. 64 bytes from 14.215.177.38 ): icmp_seq=1 ttl=55 time=11.5 ms 64 bytes from 14.215.177.38 ): icmp_seq=2 ttl=55 time=9.09 ms 64 bytes from 14.215.177.38 ): icmp_seq=3 ttl=55 time=8.71 ms 64 bytes from 14.215.177.38 ): icmp_seq=4 ttl=55 time=9.29 ms 64 bytes from 14.215.177.38 ): icmp_seq=5 ttl=55 time=8.87 ms 64 bytes from 14.215.177.38 ): icmp_seq=6 ttl=55 time=8.87 ms ^C --- www.a. ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 9068ms rtt min/avg/max/mdev = 8.711 ms
4、安装完毕,启动ubuntu
#管理员身份运行CMD C:\WINDOWS\system32>wsl youufis@LiuYuJun-K3:/mnt/c/WINDOWS/system32$
至此,可以在Linux系统下折腾和学习了。