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
编辑:传棋,审核员:薛颢
如果喜欢这位作者的文章,点点在看支持一下~
《Linux就该这么学》是一本由资深运维专家刘遄老师及国内多名红帽架构师(RHCA)基于最新RHEL7系统共同编写的高质量Linux技术自学教程,极其适合用于Linux技术入门教程或讲课辅助教材。荣获双11、双12购物狂欢节IT品类书籍销量冠军,2017年、2018年国内读者增速最快的技术书籍,您可以在京东、当当、亚马逊及天猫搜索书名后购买,亦可加刘遄老师微信交流学习(手指按住下图3秒钟即可自动扫描)~
刘遄老师QQ:5604922
☀ Linux技术交流群:2265381(新群,火热加群中……)
☀ 官方站点:www.linuxprobe.com
☀Linux命令大全:https://www.linuxcool.com
☀ 书籍在线学习(电脑在线阅读效果更佳):
http://www.linuxprobe.com/chapter-00.html
《Linux就该这么学》是一本基于最新Linux系统编写,面向零基础读者的技术书籍。从Linux基础知识讲起,然后渐进式地提高内容难度,详细讲解Linux系统中各种服务的工作原理和配置方式,以匹配真实生产环境对运维人员的要求,突显内容的实用性。想要学习Linux系统的读者可以点击按钮了解这本书,同时这本书也适合专业的运维人员阅读,作为一本非常有参考价值的工具书!