Windows10内置Linux子系统WSL

“如何让程序员重返Windows”——这就是WSL存在的意义。
WSL是Windows Subsystem for Linux的简称,即在Windows系统上的一个Linux子系统,有了它,不要再安装臃肿的Vmware和VirtualBox等虚机机系统,就可以直接在Windows上体验原生的Linux应用了,甚至还有图形界面!目前微软主要是和Canocical进行合作,推出的是Ubuntu系统,未来将会有更多的发行版供选择。
要安装WSL,首先得启用Windows 10的开发者模式。如何开启,这里不做阐述。

然后,打开控制面板,在程序和功能设置里启用WSL,如下图。设置确定后,按照提示重启电脑。

以上 准备工作完成后
打开Microsoft Store 搜索Linux ,找到如下

点击按钮  获取这些应用 ,跳转到如下图所示,选择一个系统,如 Ubuntu,下载并安装即可。
启动Ubantu,进入如下所示命令。等待Ubuntu系统安装。

安装成功。设置用户名,密码

至此,一个默认的Ubuntu版本16.04 安装完成。

试着运行Ubuntu下的命令吧!!!

在Ubuntu下我们可以通过 apt-get 命令 很方便的安装/卸载软件,由于默认的软件包仓库是位于国外的,安装软件的时候就可能遇到各种网络问题或者下载到的一些资源不完整,因此就需要切换数据源为国内的镜像站点来改善。

# 1.备份原来的数据源配置文件
cp /etc/apt/sources.list /etc/apt/sources.list_backup
# 2.编辑数据源配置文件
vi /etc/apt/sources.list

阿里云的数据源:

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

也可以添加别的源,如中科大的

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

清华大学的ubuntu源等等

添加完毕wq,保存退出配置文件。

# 3.更新配置
apt-get update

访问Windows目录,可以通过如下方式

/mnt/【盘符】/目录

好啦,最后,说下Windows10内置Linux子系统WSL的不足,据说内核不是原生的,所以要做内核方面的开发估计是不行的??

仅适合新手学习使用。
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐