win10 安装 ubuntu
环境
OS 名称: Microsoft Windows 10 家庭中文版
OS 版本: 10.0.17134 暂缺 Build 17134
OS 制造商: Microsoft Corporation
OS 配置: 独立工作站
OS 构件类型: Multiprocessor Free
安装windows的子系统, linux 环境
PowerShell # cmd 下直接输入
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
安装后重启
# 检测状态
PS C:\WINDOWS\system32> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
FeatureName : Microsoft-Windows-Subsystem-Linux
DisplayName : 适用于 Linux 的 Windows 子系统
Description : 为 Windows 上运行的本机用户模式 Linux shell 和工具提供服务和环境。
RestartRequired : Possible
State : Enabled
CustomProperties :
ServerComponent\Description : 提供服务和环境以在 Windows 上运行本机用户模式 Linux shell 和工具。
ServerComponent\DisplayName : 适用于 Linux 的 Windows 子系统
ServerComponent\Id : 1033
ServerComponent\Type : Feature
ServerComponent\UniqueName : Microsoft-Windows-Subsystem-Linux
ServerComponent\Deploys\Update\Name : Microsoft-Windows-Subsystem-Linux
下载 ubuntu 的景象
这里下载的是 ubuntu 18.04, 名字是下面这样的, 不知道什么网站, 迅雷下都慢成狗
CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.appx
安装镜像, 启动
PowerShell # 确保镜像在系统盘C中
Rename-Item '.\CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.appx' '.\ubuntu.zip'
Expand-Archive ~/Ubuntu.zip ~/Ubuntu
cd .\ubuntu\
.\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: liuhonghe
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
初始化
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
apt update -y && apt upgrade -y
apt install rsplib-legacy-wrappers
apt-get purge openssh-server
apt-get install openssh-server
service ssh start
ssh 登录
ssh liuhonghe@127.0.0.1