Windows10使用Linux子系统实现轻松安装多个linux
WSL
Windows Subsystem for Linux(简称WSL)是一个在Windows 10\11上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层。它是由微软与Canonical公司合作开发,其目标是使纯正的Ubuntu、Debian等映像能下载和解压到用户的本地计算机,并且映像内的工具和实用工具能在此子系统上原生运行。如果使用Windows10 2004以上,可以通过WSL2来窗口化运行桌面应用,也不需要另外安装其他的X服务器。该子系统不能运行所有Linux软件,但学习大多数内部命令的使用绝对方便!
准备工作
检查Window10版本,低于 18362 的版本不支持 WSL。运行 winver 的结果:
或者在 Windows 命令提示符下输入 ver 命令:
C:\Users\hann>ver
Microsoft Windows [版本 10.0.23511.1000]
检查一下Windows Terminal是否为“已初装”状态:
打开Terminal,并按快捷键 Ctrl , (Ctrl键和逗号)调出启动设置界面
照下图所示设置,保存退出:
安装Linux子系统
打开MicrosoftStore,搜索Linux,然后安装自己喜欢的发行版,我安装了Ubuntu和Debian。
如还无法正常安装,可以试试以下步骤:
- 打开子系统功能
- 以管理员身份启动PowerShell,输入如下内容,以启用Windows子系统功能:
- dism.exe/online/enable-feature/featurename:Microsoft-Windows-Subsystem-Linux/all/norestart
- 然后输入如下内容,以启用虚拟机平台功能:
- dism.exe/online/enable-feature/featurename:VirtualMachinePlatform/all/norestart
- 完成之后,重启计算机。
- 下载Linux内核更新包
- 点击此链接,以下载适用于x64计算机的WSL2Linux内核更新包。
- 下载完成后,安装。
- 然后以管理员身份运行PowerShell,输入如下内容,以设置WSL2为默认版本:
- wsl--set-default-version2
设置Unix用户名和密码
安装成功后,进入设置用户:
查看帮助 help
Ubantu的帮助:
hann@HannYang:~$ help
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
Debian的帮助:
hann@HannYang:~$ help
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
两者列出的内部命令列表基本相同:
job_spec [&] history [-c] [-d offset] [n] or history -an>
(( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS>
. filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x comm>
: kill [-s sigspec | -n signum | -sigspec] pi>
[ arg... ] let arg [arg ...]
[[ expression ]] local [option] name[=value] ...
alias [-p] [name[=value] ... ] logout [n]
bg [job_spec ...] mapfile [-d delim] [-n count] [-O origin] [>
bind [-lpsvPSVX] [-m keymap] [-f filename] [> popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]...) COMMAN> read [-ers] [-a array] [-d delim] [-i text]>
cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] [-O origin]>
command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or reado>
compgen [-abcdefgjksuv] [-o option] [-A acti> return [n]
complete [-abcdefgjksuv] [-pr] [-DEI] [-o op> select NAME [in WORDS ... ;] do COMMANDS; d>
compopt [-o|+o option] [-DEI] [name ...] set [-abefhkmnptuvxBCHP] [-o option-name] [>
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...]
declare [-aAfFgilnrtux] [-p] [name[=value] .> source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec ... | pid ...] test [expr]
echo [-neE] [arg ...] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [name ...> times
eval [arg ...] trap [-lp] [[arg] signal_spec ...]
exec [-cl] [-a name] [command [arguments ...> true
exit [n] type [-afptP] name [name ...]
export [-fn] [name[=value] ...] or export -> typeset [-aAfFgilnrtux] [-p] name[=value] .>
false ulimit [-SHabcdefiklmnpqrstuvxPT] [limit]
fc [-e ename] [-lnr] [first] [last] or fc -s> umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name ...]
for NAME [in WORDS ... ] ; do COMMANDS; don> unset [-f] [-v] [-n] [name ...]
for (( exp1; exp2; exp3 )); do COMMANDS; don> until COMMANDS; do COMMANDS; done
function name { COMMANDS ; } or name () { CO> variables - Names and meanings of some shel>
getopts optstring name [arg] wait [-fn] [id ...]
hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS; done
help [-dms] [pattern ...] { COMMANDS ; }
日常使用
打开后的样子:
键几个linux命令试试:
到此,安装结果就能正常使用了。
exit
以上就是Windows10使用Linux子系统实现轻松安装多个linux的详细内容,更多关于Windows10安装linux的资料请关注脚本之家其它相关文章!
相关文章
Apache防DDOS模块mod_evasive安装和配置方法详解
这篇文章主要介绍了Apache防DDOS模块mod_evasive安装和配置方法,需要的朋友可以参考下2014-03-03linux系统报xfs_vm_releasepage警告问题的处理方法
这篇文章主要给大家介绍了关于linux系统报xfs_vm_releasepage警告问题的处理方法,文中通过示例代码介绍的非常详细,对大家学习或者使用linux系统具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧2019-07-07
最新评论