首页 > 技术文章 >  windows server 2019 安装linux子系统

windows server 2019 安装linux子系统

1.启用Windows子系统(WSL)功能

a.以管理员身份打开PowerShell并运行以下命令以在Windows上启用Windows Subsystem for Linux(WSL)功能

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

b.安装好后会提示重启服务器,重启后继续

2.下载ubuntu-1804

curl.exe -L -o ubuntu-1804.appx https://aka.ms/wsl-ubuntu-1804

3.解压缩并安装命令

Rename-Item ubuntu-1804.appx ubuntu-1804.zip
Expand-Archive ubuntu-1804.zip ubuntu1804

4.进入文件夹后安装

cd ubuntu1804
.\ubuntu1804.exe

5.完成后创建用户和用户密码

PS C:\Users\Administrator\ubuntu1804> .\ubuntu1804.exe
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:

6.完成

Ubuntu更新系统命令

sudo apt update && sudo apt upgrade
sudo apt install ansible

示例:

Rename-Item ubuntu-1804.appx

此答案有用么?
LiveZilla Live Chat Software