设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 742|回复: 4
收起左侧

启用 Win10 的 Linux 子系统

[复制链接]
发表于 2020-6-8 00:17:36 | 显示全部楼层 |阅读模式
Windows Subsystem for Linux(简称WSL)是一个在Windows 10上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层,WSL即Windows下的Linux子系统。
启用开发者模式

打开设置


                               
登录/注册后可看大图

点击更新和安全


                               
登录/注册后可看大图

点击开发者选项,选择开发人员模式


                               
登录/注册后可看大图

更改系统功能

使用Win+X快捷键调出系统管理菜单后点击应用和功能,然后拉到底,选择程序和功能


                               
登录/注册后可看大图


                               
登录/注册后可看大图

点击启用或关闭 Windows 功能


                               
登录/注册后可看大图

勾选适用于 Linux 的 Windows 子系统,然后确认并重启 Windows 系统


                               
登录/注册后可看大图


                               
登录/注册后可看大图

安装 Linux 子系统

重启 Windows 系统后还没有安装好 Linux 子系统,需要通过 Microsoft Store 来安装


                               
登录/注册后可看大图

搜索 WSL


                               
登录/注册后可看大图

选择 Ubuntu 18.04 LTS


                               
登录/注册后可看大图

点击获取


                               
登录/注册后可看大图

点击安装


                               
登录/注册后可看大图

正在下载Ubuntu 18.04 LTS


                               
登录/注册后可看大图


                               
登录/注册后可看大图

点击启动


                               
登录/注册后可看大图


                               
登录/注册后可看大图

新建用户并设置用户密码,执行 sudo -s 切换到 root 用户


                               
登录/注册后可看大图


                               
登录/注册后可看大图

换源,更新源
cp /etc/apt/sources.list /etc/apt/sources.list.bakvim /etc/apt/sources.listdeb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverseapt-get update


                               
登录/注册后可看大图


                               
登录/注册后可看大图

安装测试软件


                               
登录/注册后可看大图

Linux老司机开火车


                               
登录/注册后可看大图


                               
登录/注册后可看大图

设置环境变量


                               
登录/注册后可看大图


                               
登录/注册后可看大图


                               
登录/注册后可看大图

老铁,双击666

快速登录 Linux 子系统

WIN + R bash


                               
登录/注册后可看大图


                               
登录/注册后可看大图

配置SSH

SSH 连接 Win10 Linux 子系统

查看是否开启SSH服务

ps -ef | grep ssh

安装SSH服务

apt-get remove openssh-serverapt-get install openssh-server

修改配置端口为22,开启允许密码登录

vim /etc/ssh/sshd_configPort 22PasswordAuthentication yes

重启服务

service ssh restart或者service ssh --full-restart通过 SecureCRT 连接 Win10 Linux 子系统


                               
登录/注册后可看大图


                               
登录/注册后可看大图


                               
登录/注册后可看大图

输入 sudo -s 切换到 root 用户

                               
登录/注册后可看大图
解除 Ubuntu 禁止 root 远程登录的限制
在 /etc/ssh/sshd_config 配置文件中添加 PermitRootLogin yesroot@T62YP5MBBDL7ZEB:~# vim /etc/ssh/sshd_config26 # Authentication:27 LoginGraceTime 12028 #PermitRootLogin without-password29 PermitRootLogin yesroot@T62YP5MBBDL7ZEB:~# service ssh restart

通过 SecureCRT 用 root 登录 Win10 Linux 子系统


                               
登录/注册后可看大图


                               
登录/注册后可看大图

本文原创地址:https://www.linuxprobe.com/win10-linux-subsystem.html编辑:传棋,审核员:薛颢


发表于 2020-6-8 08:04:29 | 显示全部楼层


回去试一下
沙发 2020-6-8 08:04:29 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-4-26 17:23 , Processed in 0.058065 second(s), 8 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表