<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Soul Of Free Loop &#187; Redstone</title>
	<atom:link href="https://zohead.com/archives/tag/redstone/feed/" rel="self" type="application/rss+xml" />
	<link>https://zohead.com</link>
	<description>Uranus Zhou&#039;s Blog</description>
	<lastBuildDate>Sat, 19 Jul 2025 15:42:46 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8</generator>
	<item>
		<title>Win10年度更新开启Bash on Ubuntu</title>
		<link>https://zohead.com/archives/win10-bash-ubuntu/</link>
		<comments>https://zohead.com/archives/win10-bash-ubuntu/#comments</comments>
		<pubDate>Sat, 06 Aug 2016 17:41:05 +0000</pubDate>
		<dc:creator><![CDATA[Uranus Zhou]]></dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Redstone]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[Win10]]></category>
		<category><![CDATA[备份]]></category>

		<guid isPermaLink="false">https://zohead.com/?p=1262</guid>
		<description><![CDATA[关于 Bash on Ubuntu 之前为了能在 Windows 上使用 Bash 等类似 Unix（Linux）系统的体验，我都是安装了 Cygwin、MSYS 等运行环境，都体验上都存在一些问题：Cygwin 上的程序基本都需要重新编译出基于其运行库（cygwin1.dll）的版本，MSYS 虽然提供了 Linux 下常用的开发工具链、移植过的运行库等等，但基本还是受限于 Windows API 本身的。 当我看到 Windows 10 Build 14316 内部预览版时爆出的 Bash on Ubuntu 功能之后还是比较期待的，因为微软并不是以虚拟机的方式运行 Ubuntu 系统，而 [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2 id="关于-bash-on-ubuntu">关于 Bash on Ubuntu</h2>
<p>之前为了能在 Windows 上使用 Bash 等类似 Unix（Linux）系统的体验，我都是安装了 Cygwin、MSYS 等运行环境，都体验上都存在一些问题：Cygwin 上的程序基本都需要重新编译出基于其运行库（cygwin1.dll）的版本，MSYS 虽然提供了 Linux 下常用的开发工具链、移植过的运行库等等，但基本还是受限于 Windows API 本身的。</p>
<p>当我看到 Windows 10 Build 14316 内部预览版时爆出的 Bash on Ubuntu 功能之后还是比较期待的，因为微软并不是以虚拟机的方式运行 Ubuntu 系统，而是直接集成了新的 <strong><a href="https://blogs.msdn.microsoft.com/wsl/">Windows Subsystem for Linux</a></strong> 子系统，这样能直接在 Bash on Ubuntu 环境里编译运行 Linux 程序还是非常方便的。</p>
<p>考虑到预览版稳定性的问题，我一直没有加入 Win10 Insider 预览体验会员，这几天看到 Win10 Redstone 1 年度更新到来之后终于可以直接体验了。虽然我使用的 Win10 企业版一直接收不到更新推送，而且使用微软官方的 Media Creation Tool 也无法在企业版上更新，但还好还是可以直接下载 Redstone 1 企业版的 iso 进行更新。</p>
<h2 id="安装体验">安装体验</h2>
<p>Win10 年度更新的持续数小时的痛苦安装过程这里就不表了，更新完成后首先在设置中开启开发者支持，然后在 控制面板 - 程序和功能 中开启 <strong>Windows Subsystem for Linux</strong> 功能，开启之后需要重启系统，重启之后在命令行中运行 <strong>bash</strong> 命令下载安装，根据你的网络情况可能又需要一两个小时（强烈建议挂代理的），安装完成之后会提示配置用户，接着就可以正常启动 Bash on Ubuntu 了：</p>
<p><img src="http://res.cloudinary.com/digwht2y0/image/upload/v1737442968/win10-bash.jpg" alt="Bash on Ubuntu on Windows 10" title="Bash on Ubuntu on Windows 10"></p>
<p>第一步就可以先运行 <code>sudo apt-get update</code> 更新 Ubuntu 软件仓库，看起来一切正常：</p>
<p><img src="http://res.cloudinary.com/digwht2y0/image/upload/v1737442967/win10-apt-get.jpg" alt="Win10 上使用 apt-get" title="Win10 上使用 apt-get"></p>
<p>另外可以确认下 Windows 10 上运行的 Ubuntu 子系统的基本情况：</p>
<p><img src="http://res.cloudinary.com/digwht2y0/image/upload/v1737442968/win10-bash-kernel.jpg" alt="Windows 10 的 Linux 子系统" title="Windows 10 的 Linux 子系统"></p>
<p>从上面的截图可以看出 Bash on Ubuntu 会把所有 Windows 分区都挂载到 <code>/mnt</code> 目录下方便使用（这点和 Cygwin 的 <code>/cygdrive/c</code> 以及 MSYS 的 <code>/c</code> 路径有点类似哦），默认运行的是 Ubuntu 14.04 LTS 系统，用户看到的 Linux kernel 是 3.4.0 版本。</p>
<p>接着就可以安装运行一些常用的 Linux 命令了，awk、sed、svn、git 等和系统内核关系不大的命令都能正常工作，<code>ifconfig</code> 和 <code>ping</code> 等命令会运行失败，体验一圈下来还是能满足我的使用需求的。</p>
<h2 id="rsync-备份性能测试">rsync 备份性能测试</h2>
<p>我之前写过一篇文章 <a href="https://zohead.com/archives/rsync-performance-linux-cygwin-msys/">rsync在 Linux/cygwin/msys 环境下的备份性能对比</a> 对比 Linux 原生的 rsync 命令和 Windows 上几种常见的非原生 rsync 实现的备份性能，结果不出意外 Linux 原生 rsync 的效果是最好的。</p>
<p>现在既然 Win10 已经支持了还算完整的 Ubuntu 子系统，那么我就可以拿 Ubuntu 子系统里的 rsync 命令来测试一下备份文件的性能到底如何了，而且这里值得一提的是 Bash on Ubuntu 安装好之后就已经自带 rsync 命令了（没有也可以妥妥的 apt-get 自动安装哦）。</p>
<p>先看看 Bash on Ubuntu 自带的 rsync 命令是 3.1.0 版本的，可以直接和我们目前使用的存储服务器配合测试：</p>
<p><img src="http://res.cloudinary.com/digwht2y0/image/upload/v1737442969/win10-rsync.jpg" alt="rsync on Windows 10" title="rsync on Windows 10"></p>
<p>为了对比方便我在相同的客户端上分别运行 RHEL6 Linux 系统和开启了 Bash on Ubuntu 的 Win10 系统使用 rsync 命令进行文件备份的上传和下载性能测试，存储服务器上运行的是标准 rsync 服务器（没有开启 SSH 用户验证）。</p>
<p>测试中也使用和上面的备份性能对比文章相似的配置，服务器使用 24 个 SATA 盘建立 RAID0 磁盘阵列做底层存储，客户端和服务器之间都是千兆网络，客户端上的文件读写都使用内存文件系统（Linux 上使用 <code>tmpfs</code>，Windows 上使用 <code>ImDisk</code> 工具生成内存盘）防止客户端本地硬盘读写性能成为瓶颈。</p>
<p>先看看 RHEL6 Linux 系统下的 rsync 备份性能结果：</p>
<pre class="brush: bash; title: ; notranslate">
/dev/shm # rsync -hv 0.dat test@192.168.1.35::sync/
Password:
0.dat

sent 1.61G bytes  received 27 bytes  82.50M bytes/sec
total size is 1.61G  speedup is 1.00

/dev/shm # rsync -hv test@192.168.1.35::sync/0.dat .
Password:
0.dat

sent 59 bytes  received 1.61G bytes  91.93M bytes/sec
total size is 1.61G  speedup is 1.00
</pre>
<p>可以看到 Linux 系统下 rsync 写一个大概 1.6 GB 的文件可以达到 82.50 MB/s，读可以到 91.93 MB/s。</p>
<p>然后在 Win10 的 Bash 环境中同样使用自带 rsync 命令进行测试：</p>
<pre class="brush: bash; title: ; notranslate">
zzm@ZZM-VOLANS:~$ rsync -hv 1.dat 192.168.1.35::sync/
1.dat

sent 1.57G bytes  received 30 bytes  89.90M bytes/sec
total size is 1.57G  speedup is 1.00

zzm@ZZM-VOLANS:/mnt/h$ rsync -hv 192.168.1.35::sync/1.dat .
1.dat

sent 45 bytes  received 1.57G bytes  95.34M bytes/sec
total size is 1.57G  speedup is 1.00
</pre>
<p>看起来结果还是比较惊喜的，Win10 Bash 上的 rsync 命令可以基本跑满千兆网卡的带宽，备份性能甚至比 Linux 上的效果还好了那么一点点。这样不得不说我之前写的那篇文章里总结的 Windows 推荐使用 Cygwin 做 rsync 客户端的建议在 Bash on Ubuntu 推出之后就要过时咯。</p>
<h2 id="总结">总结</h2>
<p>从 Win10 年度更新的简单试用和性能测试情况来看，Bash on Ubuntu 目前还算比较符合我的预期的，毕竟我最想要的直接在 Windows 上编译 Linux 二进制程序就更加方便了，看起来也不需要专门开虚拟机来进行编译工作中需要用到的 Linux 内核和应用程序了。当然目前 Bash on Ubuntu 仍然有不少问题和限制（毕竟还是 beta 阶段），还是希望微软能在后续更新中解决咯，祝大家玩的开心。</p>
]]></content:encoded>
			<wfw:commentRss>https://zohead.com/archives/win10-bash-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
