20160823022639

初试Windows 10子系统

在Windows 10 RS1中,系统自带了一个linux的子系统。对于开发人员来说方便了不少,很多Linux下专有的工具或者实现自动化功能的脚本都能得到使用。

开启方法见:在新版 Win10 中启用 Linux Bash 环境

开启完后发现系统默认是ubuntu 14.04.4 tls。对于我来说,有些工具还是旧了点,ubuntu tls最新已经是16.04.1了,所以先需要升级。运行下下脚本:

# Upgrade all the packages to the latest versions
aptitude update
aptitude full-upgrade -y
# Update our sources, save the original as /etc/apt/sources.list.ORIG
# This step is REQUIRED, otherwise the instructions below will not upgrade a
# single package.
sed -i.ORIG 's/trusty/xenial/g' /etc/apt/sources.list
# Backup the /etc/apt/sources.list.d/ folder and create an empty one.
# This will disable all Third Party/Launchpad PPA repositories.
# These repositories can be re-enabled after a successful upgrade.
mv /etc/apt/sources.list.d /etc/apt/sources.list.d.ORIG
mkdir /etc/apt/sources.list.d
# Upgrade your box--the easy part.
aptitude update
aptitude safe-upgrade -y
# Now for the scary one--see below.
apt-get dist-upgrade

参考:https://gist.github.com/anonymous/21fc9043b1ee3fa3660cd4d513ee67d5

升级完成后再进入bash,执行sudo时出现以下错误:

在“运行”中输入
%localappdata%\lxss\rootfs\etc
20160823022639

找到sudoers文件,编辑。
增加行 Defaults visiblepw
20160823022802

如果出现

则编辑sudoers文件,注释Defaults requiretty:
Defaults requiretty 修改为 #Defaults requiretty, 表示不需要控制终端。
退出再进入bash,这样就没问题了。

总结

试用了一会儿,感觉还是不错的。性能比虚拟机高,应用层的软件都没问题,系统层的估计就不行了。平时用一下gcc,squid等就差不多了。网上也有人成功运行图形化界面。
目前主要发现两个问题:
1.系统升级后内核不是旧的内核。这个问题其实也不太重要了,毕竟不可能完全像运行真实系统一样,估计就像是linux下wine,有一个兼容层。
2.退出bash后,程序的生命周期结束。当我运行squid,退出bash后,telnet 127.0.0.1 3128就不通了。至于有没有办法长期驻留在后台,后面再研究。
总之试用windows 10子系统不到两个小时,很多东西还没摸索。不管怎么说,对个人还是很方便的,希望后面windows 10能加强这些功能,降低其他人学习linux的门槛。


已发布

分类

,

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注