<?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>易水博客 &#187; 开源软件</title>
	<atom:link href="http://easwy.com/blog/archives/category/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://easwy.com/blog</link>
	<description>关注Linux, Scala, Android, Java, 开源软件和嵌入式系统</description>
	<lastBuildDate>Mon, 12 Mar 2012 02:03:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easwy的vim配置共享：包括.vimrc及整个.vim目录</title>
		<link>http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/</link>
		<comments>http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 02:03:30 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[文本处理]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1160</guid>
		<description><![CDATA[<p>刚才有网友来信询问我的vim配置，我在很久以前已经把我的所有vim配置上传到github了，有兴趣的朋友可以在<a href="https://github.com/easwy/share/tree/master/vim/vimrc" title="Easwy的.vimrc和.vim目录" target="_blank"></a>找到我最新的.vimrc和整个的.vim目录。</p>
<p>你可以点此<a href="https://github.com/easwy/share/zipball/master" title="下载Easwy的vimrc" target="_blank">下载Easwy的vimrc</a>，如果你了解git，你也可以使用git命令下载整个版本历史：</p>

<code>git clone https://github.com/easwy/share.git</code>

<p>用这种方式，你可以随时跟踪我的最新修改，或者把你对vimrc的改变通知我。</p>
<p>Happy Vimming!</p> <a href="http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/add_post_copyright_url/' rel='bookmark' title='在文章末尾添加版本声明和文章的链接'>在文章末尾添加版本声明和文章的链接</a></li>
<li><a href='http://easwy.com/blog/archives/vi-tip-of-using-recording/' rel='bookmark' title='vi技巧: 宏的使用技巧'>vi技巧: 宏的使用技巧</a></li>
<li><a href='http://easwy.com/blog/archives/advanced-vim-skills-catalog/' rel='bookmark' title='vi/vim使用进阶: 目录'>vi/vim使用进阶: 目录</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>刚才有网友来信询问我的vim配置，我在很久以前已经把我的所有vim配置上传到github了，有兴趣的朋友可以在<a href="https://github.com/easwy/share/tree/master/vim/vimrc" title="Easwy的.vimrc和.vim目录" target="_blank">Easwy的Github共享</a>找到我最新的.vimrc和整个的.vim目录。</p>
<p>你可以点此<a href="https://github.com/easwy/share/zipball/master" title="下载Easwy的vimrc" target="_blank">下载Easwy的vimrc</a>，如果你了解git，你也可以使用git命令下载整个版本历史：</p>
<p><code>git clone https://github.com/easwy/share.git</code></p>
<p>用这种方式，你可以随时跟踪我的最新修改，或者把你对vimrc的改变通知我。</p>
<p>Happy Vimming!</p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/" target="_top">http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/add_post_copyright_url/' rel='bookmark' title='在文章末尾添加版本声明和文章的链接'>在文章末尾添加版本声明和文章的链接</a></li>
<li><a href='http://easwy.com/blog/archives/vi-tip-of-using-recording/' rel='bookmark' title='vi技巧: 宏的使用技巧'>vi技巧: 宏的使用技巧</a></li>
<li><a href='http://easwy.com/blog/archives/advanced-vim-skills-catalog/' rel='bookmark' title='vi/vim使用进阶: 目录'>vi/vim使用进阶: 目录</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>在CentOS 5上安装Ubuntu KVM虚拟机</title>
		<link>http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/</link>
		<comments>http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 13:36:29 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1156</guid>
		<description><![CDATA[Linux下免费的虚拟化技术主要有KVM和XEN两种。KVM已经合入了Linux标准内核，也获得了诸如RedHat RHEL、Ubuntu这样的Linux发行版的支持，可以预见在未来KVM应该会成为Linux虚拟化技术的主流。只是KVM需要硬件虚拟化技术的支持，如果你的CPU不支持硬件虚拟化技术，那么只能使用XEN。

本文记录了Easwy在CentOS 5.7上安装Ubuntu KVM虚拟机的过程。  <a href="http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/' rel='bookmark' title='Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题'>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</a></li>
<li><a href='http://easwy.com/blog/archives/disable-ipv6-in-centos-and-redhat/' rel='bookmark' title='Linux使用笔记：在CentOS 5中关闭IPv6'>Linux使用笔记：在CentOS 5中关闭IPv6</a></li>
<li><a href='http://easwy.com/blog/archives/ssh-login-no-password-needed/' rel='bookmark' title='Linux使用笔记: 实现ssh不需要密码登录'>Linux使用笔记: 实现ssh不需要密码登录</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    Linux下免费的虚拟化技术主要有KVM和XEN两种。KVM已经合入了Linux标准内核，也获得了诸如RedHat RHEL、Ubuntu这样的Linux发行版的支持，可以预见在未来KVM应该会成为Linux虚拟化技术的主流。只是KVM需要硬件虚拟化技术的支持，如果你的CPU不支持硬件虚拟化技术，那么只能使用XEN。
  </p>
<p>
    本文记录了<a href="http://easwy.com/" target="_top">Easwy</a>在CentOS 5.7上安装Ubuntu KVM虚拟机的过程。
  </p>
<div class="orderedlist">
<ol type="1">
<li>
      <span class="bold"><strong>环境检查</strong></span></p>
<p>
        首先需要检查一下你的CPU是否支持硬件虚拟化技术(Hardware Vitualization)：
      </p>
<pre class="programlisting">egrep '(vmx|svm)' --color=always /proc/cpuinfo </pre>
<p>
        如果在你的计算机上没有任何输出，那么说明你的CPU不支持硬件虚拟化技术，也就无法使用KVM。
      </p>
<p>
        另外需要注意的是，在CentOS 5.4版本以后，只有64位的CentOS才支持KVM，具体原因不清楚，所以如果你是32位的CentOS，暂时也无法使用KVM。
      </p>
</li>
<li>
      <span class="bold"><strong>安装KVM</strong></span></p>
<p>
        检查完环境后，我们开始安装并激活KVM。
      </p>
<p>
        首先，将SELinux的配置更改为<span class="bold"><strong>Permissive</strong></span>，因为<code class="code">virt-install</code>不支持SELinux为<span class="emphasis"><em>disable</em></span>：
      </p>
<pre class="programlisting">[root@srv-easwy ~]# system-config-securitylevel </pre>
<p>
        然后安装kvm及其它虚拟化相关的软件：
      </p>
<pre class="programlisting">[root@srv-easwy ~]# yum install kvm kmod-kvm libvirt python-virtinst virt-manager</pre>
<p>
        接下来需要重启系统，在启动完成后，你应该可以看到KVM内核模块已经被加载了：
      </p>
<pre class="programlisting">
[root@srv-easwy ~]# lsmod |grep kvm
kvm_intel              85256  1
kvm                   224800  2 ksm,kvm_intel </pre>
<p>
        可以通过下面的命令看看KVM是不是真正运行了：
      </p>
<pre class="programlisting">
[root@srv-easwy ~]# virsh -c qemu:///system list
Id Name                 State
----------------------------------

[root@srv-easwy ~]# </pre>
</li>
<li>
      <span class="bold"><strong>配置网络</strong></span></p>
<p>
        现在配置一个网桥，以便虚拟机可以访问网络。首先安装所需的工具：
      </p>
<pre class="programlisting">[root@srv-easwy ~]# yum install bridge-utils </pre>
<p>
        新创建一个文件<span class="emphasis"><em>/etc/sysconfig/network-scripts/ifcfg-br0</em></span>，其内容为：
      </p>
<pre class="programlisting">
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes </pre>
<p>
        上面的文件配置此网桥以DHCP方式获取IP地址。接下来修改原来的网卡配置<span class="emphasis"><em>/etc/sysconfig/network-scripts/ifcfg-eth0</em></span>，修改为：
      </p>
<pre class="programlisting">
DEVICE=eth0
HWADDR=B8:AC:6F:89:10:76
ONBOOT=yes
BRIDGE=br0 </pre>
<p>
        然后重启网络配置，查看一下：
      </p>
<pre class="programlisting">
[root@srv-easwy ~]# /etc/init.d/network restart
[root@srv-easwy ~]# ifconfig
br0       Link encap:Ethernet  HWaddr B8:AC:6F:89:10:76
          inet addr:172.23.5.50  Bcast:172.23.5.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3242738 errors:0 dropped:0 overruns:0 frame:0
          TX packets:702638 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1057883287 (1008.8 MiB)  TX bytes:448735998 (427.9 MiB)

eth0      Link encap:Ethernet  HWaddr B8:AC:6F:89:10:76
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3445641 errors:0 dropped:0 overruns:0 frame:93
          TX packets:670754 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1201230368 (1.1 GiB)  TX bytes:239453000 (228.3 MiB)
          Interrupt:177 Memory:f3de0000-f3df0000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:63582 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63582 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:154537675 (147.3 MiB)  TX bytes:154537675 (147.3 MiB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1797 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:470443 (459.4 KiB)
      </pre>
</li>
<li>
      <span class="bold"><strong>安装虚拟机</strong></span></p>
<p>
        基于磁盘逻辑卷管理(LVM)的虚拟机会拥有较好的磁盘I/O性能，所以在此处<a href="http://easwy.com/" target="_top">Easwy</a>安装了基于LVM的虚拟机。如果你对LVM并不熟悉，可以参考我的<a href="http://easwy.com/blog/archives/linux-lvm-learning-notes/" target="_top">Linux逻辑卷管理器(LVM)学习笔记</a>。
      </p>
<p>
        Easwy在安装时已经在逻辑卷组中预留了部分未用空间，所以此处直接在卷组<span class="emphasis"><em>vg0</em></span>中创建一个逻辑卷<span class="emphasis"><em>ubuntu</em></span>，并分配了332G的空间：
      </p>
<pre class="programlisting">[root@srv-easwy ~]# lvcreate -L32G -n ubuntu vg0 </pre>
<p>
        接下来使用<code class="code">virt-install</code>安装Ubuntu虚拟机，在此处直接使用Ubuntu的ISO文件做为源，将其安装到新创建的逻辑卷<span class="emphasis"><em>/dev/vg0/ubuntu</em></span>中：
      </p>
<pre class="programlisting">
[root@srv-easwy ~]# virt-install --connect qemu:///system -n ubuntu -r 1024 --vcpus=2 -f /dev/vg0/ubuntu -c ~/Download/ubuntu/ubuntu-10.04.3-desktop-amd64.iso --vnc --os-type linux --os-variant generic26 --accelerate --network=bridge:br0 --hvm --noautoconsole</pre>
<p>
        执行完此命令后，KVM虚拟机会使用Ubuntu的ISO文件启动，我们需要启动<code class="code">virt-manager</code>，连接到此虚拟机，继续完成安装过程。这和安装真正的Linux操作系统完全一样，不再赘述。
      </p>
</li>
</ol>
</div>
<p>
    现在，基本KVM的Ubuntu虚拟机就完全运行起来了。如果你对此还有疑问，欢迎留言。另外，参考文档中的链接也许对你也很有帮助。
  </p>
<p>
    更多内容，请阅读<a href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li>
      <a href="http://www.howtoforge.com/virtualization-with-kvm-on-a-centos-5.2-server" target="_top">Virtualization With KVM On A CentOS 5.2 Server</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/" target="_top">http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/' rel='bookmark' title='Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题'>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</a></li>
<li><a href='http://easwy.com/blog/archives/disable-ipv6-in-centos-and-redhat/' rel='bookmark' title='Linux使用笔记：在CentOS 5中关闭IPv6'>Linux使用笔记：在CentOS 5中关闭IPv6</a></li>
<li><a href='http://easwy.com/blog/archives/ssh-login-no-password-needed/' rel='bookmark' title='Linux使用笔记: 实现ssh不需要密码登录'>Linux使用笔记: 实现ssh不需要密码登录</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux逻辑卷管理器(LVM)学习笔记</title>
		<link>http://easwy.com/blog/archives/linux-lvm-learning-notes/</link>
		<comments>http://easwy.com/blog/archives/linux-lvm-learning-notes/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 10:10:54 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1150</guid>
		<description><![CDATA[通过使用Linux的逻辑卷管理器(Logical Volume Manager, LVM)，用户可以在系统运行时动态调整文件系统的大小，把数据从一块硬盘重定位到另一块硬盘，也可以提高I/O操作的性能，以及提供冗余保护，它的快照功能允许用户对逻辑卷进行实时的备份。

对一般用户来讲，使用最多的是动态调整文件系统大小的功能。这样，你在分区时就不必为如何设置分区的大小而烦恼，只要在硬盘中预留出部分空闲空间，然后根据系统的使用情况，动态调整分区大小。

本文总结了Easwy对于LVM的理解。  <a href="http://easwy.com/blog/archives/linux-lvm-learning-notes/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/huawei-android-mobile-phone-overview/' rel='bookmark' title='华为Android手机预计第三季度上市'>华为Android手机预计第三季度上市</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/' rel='bookmark' title='解决Thinkpad T400在Debian Linux下不能休眠/待机的问题'>解决Thinkpad T400在Debian Linux下不能休眠/待机的问题</a></li>
<li><a href='http://easwy.com/blog/archives/linux-remote-desktop-by-vnc/' rel='bookmark' title='用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)'>用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    通过使用Linux的逻辑卷管理器(Logical Volume Manager, LVM)，用户可以在系统运行时动态调整文件系统的大小，把数据从一块硬盘重定位到另一块硬盘，也可以提高I/O操作的性能，以及提供冗余保护，它的快照功能允许用户对逻辑卷进行实时的备份。
  </p>
<p>
    对一般用户来讲，使用最多的是动态调整文件系统大小的功能。这样，你在分区时就不必为如何设置分区的大小而烦恼，只要在硬盘中预留出部分空闲空间，然后根据系统的使用情况，动态调整分区大小。
  </p>
<p>
    以下内容总结了<a href="http://easwy.com/" target="_top">Easwy</a>对于LVM的理解。
  </p>
<p>
    在LVM中，主要有三个概念：
  </p>
<div class="itemizedlist">
<ul type="disc">
<li>
      <span class="bold"><strong>物理卷(Physical Volume, PV)：</strong></span> 物理卷可以是一个磁盘，也可以是磁盘中的一个分区。它为LVM提供了存储介质。
    </li>
<li>
      <span class="bold"><strong>逻辑卷组(Logical Volume Group, LVG)：</strong></span> 可以把逻辑卷组想象成一个存储池，或者是逻辑硬盘。物理卷与物理卷在硬件上可以是不连续的，但把多个物理卷加入逻辑卷组后，就可以把这个逻辑卷组看成一个存储空间连续的逻辑硬盘，在这块硬盘上，可以创建多个逻辑卷(LV)。
    </li>
<li>
      <span class="bold"><strong>逻辑卷(Logical Volume, LV)：</strong></span> 可以将卷组划分成若干个逻辑卷，相当于在逻辑硬盘上划分出几个逻辑分区，每个逻辑分区上都可以创建具体的文件系统。
    </li>
</ul>
</div>
<p>
    到这里我们可以看出，原本是直接在硬盘上创建分区，然后在分区上创建文件系统。使用了LVM后，在其中插入一个逻辑层，相当于是在一块逻辑硬盘上创建逻辑分区，然后在逻辑分区上创建文件系统。
  </p>
<p>
    新插入一个逻辑层，对单个硬盘的读写会有一定的性能损失，但其带来的好处是巨大的。首先，逻辑分区大小不再受硬盘实际大小的限制，它可以扩展到几块硬盘上；其次，逻辑分区可以很方便的做调整大小、备份等维护操作；而且，如果系统中存在多块硬盘，通过设置逻辑卷到物理卷的映射关系(采用LVM striped mapping)，可以提高I/O的读写性能，因为此时的读写是在多块硬盘上并发进行的，比对单个硬盘的读写显然要快很多。
  </p>
<p>
     下面是一个LVM使用的例子：
  </p>
<div id="attachment_1151" class="wp-caption aligncenter" style="width: 723px"><a href="http://easwy.com/blog/uploads/2012/02/vg.png"><img src="http://easwy.com/blog/uploads/2012/02/vg.png" alt="Linux下逻辑卷管理器(LVM)示例" title="Linux下逻辑卷管理器(LVM)示例" width="713" height="270" class="size-full wp-image-1151" /></a><p class="wp-caption-text">Linux下逻辑卷管理器(LVM)的一个例子</p></div>
<p>
    在图中有两块硬盘，其中硬盘1分了两个分区，<span class="emphasis"><em>/dev/sda1</em></span>和<span class="emphasis"><em>/dev/sda2</em></span>，硬盘2没有创建分区。接下来在<span class="emphasis"><em>/dev/sda2</em></span>和<span class="emphasis"><em>/dev/sdb</em></span>上创建物理卷，然后把这两个物理卷加入到逻辑卷组<span class="emphasis"><em>vg0</em></span>中，现在，逻辑卷组vg0看起来像一块很大的逻辑硬盘，然后在其中创建两个逻辑卷<span class="emphasis"><em>/dev/vg0/lv0</em></span>和<span class="emphasis"><em>/dev/vg0/lv1</em></span>。
  </p>
<p>
    最后，分别在<span class="emphasis"><em>/dev/sda1</em></span>、<span class="emphasis"><em>/dev/vg0/lv0</em></span>和<span class="emphasis"><em>/dev/vg0/lv1</em></span>上创建文件系统，并分别把它们挂载到文件系统树中。这样看上去，逻辑卷是不是很像是一个逻辑的分区？
  </p>
<p>
    在逻辑卷组vg0中，还预留有一部分空间未用，如果在使用中发现某个逻辑卷空间不够用了，可以在不停机的情况下，直接调整逻辑卷及其上的文件系统的大小。对服务器来讲，这是简单但非常有用的功能。
  </p>
<p>
    更多内容，请阅读<a href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li>
      <a href="http://www.redhat.com/magazine/009jul05/features/lvm2/" target="_top">The Linux Logical Volume Manager</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/linux-lvm-learning-notes/" target="_top">http://easwy.com/blog/archives/linux-lvm-learning-notes/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/huawei-android-mobile-phone-overview/' rel='bookmark' title='华为Android手机预计第三季度上市'>华为Android手机预计第三季度上市</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/' rel='bookmark' title='解决Thinkpad T400在Debian Linux下不能休眠/待机的问题'>解决Thinkpad T400在Debian Linux下不能休眠/待机的问题</a></li>
<li><a href='http://easwy.com/blog/archives/linux-remote-desktop-by-vnc/' rel='bookmark' title='用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)'>用VNC实现远程桌面共享(支持Windows, Linux, &#8230;)</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/linux-lvm-learning-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Ubuntu上编译vim 7.3</title>
		<link>http://easwy.com/blog/archives/compile-vim73-on-ubuntu/</link>
		<comments>http://easwy.com/blog/archives/compile-vim73-on-ubuntu/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 16:13:13 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[文本处理]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1113</guid>
		<description><![CDATA[本文介绍了在Ubuntu中编译vim 7.3的方法。 <a href="http://easwy.com/blog/archives/compile-vim73-on-ubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/' rel='bookmark' title='在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;'>在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;</a></li>
<li><a href='http://easwy.com/blog/archives/compile-android-gingerbread-2-3-1/' rel='bookmark' title='在Ubuntu上编译Android Gingerbread 2.3.1'>在Ubuntu上编译Android Gingerbread 2.3.1</a></li>
<li><a href='http://easwy.com/blog/archives/chinese_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置中文'>在Debian Lenny中配置中文</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    <a class="ulink" href="http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/" target="_top">在Thinkpad T400上安装完Ubuntu 10.04 LTS</a>后，就开始搭建<a class="ulink" href="http://easwy.com/blog/archives/tag/android/" target="_top">Android</a>开发环境，第一步当然是编译vim。
  </p>
<p>
    目前最新的vim版本是7.3，因为从vim 7.3开始已经换用Mercurial做为版本管理工具，我们在下载vim 7.3源代码前，先要安装Mercurial:
  </p>
<pre class="programlisting">
sudo aptitude install mercurial
cd ~
hg clone https://vim.googlecode.com/hg/ vim73</pre>
<p>
    执行完上面的命令后，我们就取得了vim 7.3的最新代码，放在目录<span class="emphasis"><em>~/vim73</em></span>中，接下来准备编译。在编译前，需要安装编译时需要的包，在<a class="ulink" href="http://easwy.com/blog/archives/tag/ubuntu/" target="_top">Ubuntu</a>上用如下命令：
  </p>
<pre class="programlisting">
sudo aptitude install xorg-dev libx11-dev libgtk2.0-dev libncurses5-dev </pre>
<p>
    上面是<a class="ulink" href="http://easwy.com/" target="_top">Easwy</a>在编译前所安装的依赖文件。后来在一篇帖子中看到另一种方法安装依赖文件，可能更方便(未测试)：
  </p>
<pre class="programlisting">
sudo aptitude install build-essential
sudo aptitude build-dep vim-gtk </pre>
<p>
    接下来修改<span class="emphasis"><em>~/vim73/src/Makefile</em></span>，打开自己所需要的功能，Easwy打开了下面这些特性：
  </p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
      CONF_OPT_CSCOPE = &#8211;enable-cscope
    </li>
<li class="listitem">
      CONF_OPT_MULTIBYTE = &#8211;enable-multibyte
    </li>
<li class="listitem">
      CONF_OPT_INPUT = &#8211;enable-xim
    </li>
<li class="listitem">
      CONF_OPT_OUTPUT = &#8211;enable-fontset
    </li>
<li class="listitem">
      CONF_OPT_FEAT = &#8211;with-features=big
    </li>
<li class="listitem">
      CONF_OPT_COMPBY = “&#8211;with-compiledby=Easwy Yang &lt;easwy.mail@gmail.com&gt;”
    </li>
</ul>
</div>
<p>
    接下来编译安装：
  </p>
<pre class="programlisting">
cd ~/vim73/src
make &amp;&amp; make install </pre>
<p>
    执行完后编译好的vim以及gvim就安装在<span class="emphasis"><em>/usr/local/bin</em></span>目录中了。将此目录加入PATH即可。
  </p>
<p>
    Easwy在编译后，每次运行gvim都会提示：
  </p>
<pre class="screen">
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Error: Aborting: no fontset found </pre>
<p>
    后来在网上查了一下，是因为没有安装<span class="emphasis"><em>libgtk2.0-dev</em></span>包造成后，安装此包再重新编译后问题解决。
  </p>
<p>
    如果你在编译gvim时遇到了问题，可以参考我以前写的一篇文章：<a class="ulink" href="http://easwy.com/blog/archives/advanced-vim-skills-solve-compile-problem/" target="_top">vi/vim使用进阶: vim编译中遇到的问题及解决方法</a>。
  </p>
<p>
    最后，把我们编译的vim 7.3做为Ubuntu中的缺省编辑器，执行如下命令：
  </p>
<pre class="programlisting">
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/vim 50 --slave /usr/share/man/man1/editor.1.gz editor.1.gz /usr/local/man/man1/vim.1.gz
sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/vim 50 --slave /usr/share/man/man1/vi.1.gz vi.1.gz /usr/local/man/man1/vim.1.gz </pre>
<p>
    Happy viming!
  </p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
      <a class="ulink" href="http://www.vim.org/mercurial.php" target="_top">The Vim Mercurial repository</a>
    </li>
<li class="listitem">
      <a class="ulink" href="http://forum.ubuntu.org.cn/viewtopic.php?t=11432&amp;highlight=vim7" target="_top">ubuntu编译VIM7指南</a>
    </li>
<li class="listitem">
      <a class="ulink" href="http://hi.baidu.com/yulanding/blog/item/71ccaa3d67fc71ce7d1e71d8.html" target="_top">系统管理：update-alternatives</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/compile-vim73-on-ubuntu/" target="_top">http://easwy.com/blog/archives/compile-vim73-on-ubuntu/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/' rel='bookmark' title='在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;'>在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;</a></li>
<li><a href='http://easwy.com/blog/archives/compile-android-gingerbread-2-3-1/' rel='bookmark' title='在Ubuntu上编译Android Gingerbread 2.3.1'>在Ubuntu上编译Android Gingerbread 2.3.1</a></li>
<li><a href='http://easwy.com/blog/archives/chinese_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置中文'>在Debian Lenny中配置中文</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/compile-vim73-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>在Thinkpad T400上安装Ubuntu</title>
		<link>http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/</link>
		<comments>http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/#comments</comments>
		<pubDate>Mon, 27 Dec 2010 16:05:29 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1112</guid>
		<description><![CDATA[利用周末的时间在自己的Thinkpad T400 AA1上安装了Ubuntu 10.04 LTS版本，这篇文章做为安装Ubuntu的一个小结。
首先在Ubuntu官网上下载了Ubuntu 10.04 LTS Desktop版，刻录后使用光盘启动。整个的安装过程很顺利，不得不说Ubuntu在易用性和用户界面方面下了很大的工夫，它的安装过程以及界面已经可以和Windows相媲美了。感谢Ubuntu把Linux从专业人士的工具变成了普通大众能接受的操作系统，相信在不远的将来，Linux在桌面领域会有更长足的进步。
安装完后，登录Gnome，有一种眼前一亮的感觉，曾几何时，Linux的图形界面已经做的美观如斯。并且现在Linux也非常的易用，已经不再需要费心的去安装/配置各种驱动。对Thinkpad T400的硬件，Ubuntu都能正确的识别出来：显卡(集成)正常、声卡正常、网卡以及无线网卡都可以正常工作，电源管理工作正常(能够正常待机)......
在接下来的篇幅中，Easwy将简要介绍一下自己所做的一些配置。  <a href="http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
<li><a href='http://easwy.com/blog/archives/debian-lenny-installation-on-thinkpad-t400/' rel='bookmark' title='在thinkpad t400上安装debian lenny'>在thinkpad t400上安装debian lenny</a></li>
<li><a href='http://easwy.com/blog/archives/compile-vim73-on-ubuntu/' rel='bookmark' title='在Ubuntu上编译vim 7.3'>在Ubuntu上编译vim 7.3</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    一直以来，Easwy所使用的Linux发行版都是<a class="ulink" href="http://easwy.com/blog/archives/tag/debian/" target="_top">Debian</a>。因为Easwy喜欢Debian上丰富的软件、便捷的安装/升级方式，以及它所代表的自由精神。前些天，Easwy预定了一部魅9手机，为了充分体验DIY的乐趣，Easwy决定自己为魅9手机编译一个ROM。因为魅9基于Android系统，为了编译<a class="ulink" href="http://easwy.com/blog/archives/tag/android/" target="_top">Android</a>，Easwy利用周末的时间在自己的Thinkpad T400 AA1上安装了Ubuntu 10.04 LTS版本，这篇文章做为安装Ubuntu的一个小结。
  </p>
<p>
    首先在Ubuntu官网上下载了Ubuntu 10.04 LTS Desktop版，刻录后使用光盘启动，我的Ubuntu之旅就开始。整个的安装过程很顺利，不得不说Ubuntu在易用性和用户界面方面下了很大的工夫，它的安装过程以及界面已经可以和Windows相媲美了。感谢Ubuntu把Linux从专业人士的工具变成了普通大众能接受的操作系统，相信在不远的将来，Linux在桌面领域会有更长足的进步。
  </p>
<p>
    安装完后，登录Gnome，有一种眼前一亮的感觉，曾几何时，Linux的图形界面已经做的美观如斯。并且现在Linux也非常的易用，已经不再需要费心的去安装/配置各种驱动。对Thinkpad T400的硬件，Ubuntu都能正确的识别出来：显卡(集成)正常、声卡正常、网卡以及无线网卡都可以正常工作，电源管理工作正常(能够正常待机)&#8230;&#8230;
  </p>
<p>
    因为<a class="ulink" href="http://easwy.com/blog/archives/tag/ubuntu/" target="_top">Ubuntu</a>以Debian Unstable版本为基础，所以对于拥有Debian使用经验的Easwy来说有一种天然的熟悉感。在接下来的篇幅中，Easwy将简要介绍一下自己所做的一些配置。
  </p>
<p><span class="bold"><strong>[ sudo不需要输入密码 ]</strong></span></p>
<p>
    Ubuntu缺省禁止root用户登录。在需要root权限执行命令时，用户需要使用sudo来执行相应的命令。为了在sudo时不需要输入密码，我们首先执行命令<span class="command"><strong>sudo visudo</strong></span>，这条命令会用缺省编辑器打开一个文件，找到下面这一行内容：
  </p>
<pre class="programlisting">
%admin ALL=(ALL) ALL </pre>
<p>
    将其改为：
  </p>
<pre class="programlisting">
%admin ALL=(ALL) NOPASSWD: ALL </pre>
<p>
    保存退出后，以后再使用sudo就不需要再输入密码了。
  </p>
<p><span class="bold"><strong>[ 修改更新源 ]</strong></span></p>
<p>
    在Debian/Ubuntu中安装或升级软件时，都会自动从你配置的服务器上下载相应的软件，因此选择一个下载速度较快的源就非常重要。
  </p>
<p>
    在<a class="ulink" href="http://wiki.ubuntu.org.cn/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%88%91%E4%BB%AC%E6%8E%A8%E8%8D%90%E7%9A%84%E6%BA%90" target="_top">Ubuntu中文Wiki</a>上列出了国内用户常用的源，你可以为自己选择一个最快的源。使用文本编辑器打开文件<span class="emphasis"><em>/etc/apt/source.list</em></span>，将你所用的源加进去就行了。在这里，Easwy所用的源是台湾的官方源：
  </p>
<pre class="programlisting">
$ sudo vi /etc/apt/source.list

# Add your source here...

deb http://tw.archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse </pre>
<p>
    需要注意的是在添加源时，需要使用正确的版本名。上面源中的<span class="emphasis"><em>lucid</em></span>就是Easwy所安装的10.04 LTS版本。可以在中文Wiki中找到你所用的版本名称。
  </p>
<p><span class="bold"><strong>配置Thinkpad的小红点</strong></span></p>
<p>
    小红点是Thinkpad系列电脑的特色了，想让小红点在Ubuntu下正常工作，需要新建一个文件：
  </p>
<pre class="programlisting">
sudo vi /usr/lib/X11/xorg.conf.d/20-thinkpad.conf

# Add following lines...

Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint"
MatchDevicePath "/dev/input/event*"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "false"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection </pre>
<p>
    然后重启一下电脑，小红点就可以正常工作了。 在Ubuntu 10.10版本中需要把文件保存为<span class="emphasis"><em>/usr/share/X11/xorg.conf.d/20-thinkpad.conf</em></span>。
  </p>
<p>
    至此，Easwy的Ubuntu环境就基本完成了。更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
      <a class="ulink" href="http://www.eastwoodzhao.com/thinkpad-middle-button-scroll-ubuntu-linux-10-04-lucid-lynx/" target="_top">ThinkPad Middle Button Scroll – Ubuntu Linux Maverick Meerkat 10.10 &amp; Lucid Lynx 10.04</a>
    </li>
<li class="listitem">
      <a class="ulink" href="http://wiki.ubuntu.org.cn/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%88%91%E4%BB%AC%E6%8E%A8%E8%8D%90%E7%9A%84%E6%BA%90" target="_top">Ubuntu国内常用源服务器</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/" target="_top">http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
<li><a href='http://easwy.com/blog/archives/debian-lenny-installation-on-thinkpad-t400/' rel='bookmark' title='在thinkpad t400上安装debian lenny'>在thinkpad t400上安装debian lenny</a></li>
<li><a href='http://easwy.com/blog/archives/compile-vim73-on-ubuntu/' rel='bookmark' title='在Ubuntu上编译vim 7.3'>在Ubuntu上编译vim 7.3</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/install-ubuntu-on-thinkpad-t400-aa1/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>在Windows上安装配置Apache FOP</title>
		<link>http://easwy.com/blog/archives/install-apache-fop-on-windows/</link>
		<comments>http://easwy.com/blog/archives/install-apache-fop-on-windows/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 11:17:55 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[文本处理]]></category>
		<category><![CDATA[docbook]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1059</guid>
		<description><![CDATA[在使用Apache FOP将Docbook文档转换成PDF一文中，Easwy介绍了在Debian Linux上使用Apache FOP将Docbook文档转换成PDF文件。本来在那篇文章之后，Easwy想写一篇如何在Windows上配置Apache FOP的文章，不过一直没抽出时间。今天刚好有网友问这个问题，于是教她一步步做下来，把步骤列在下面。  <a href="http://easwy.com/blog/archives/install-apache-fop-on-windows/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/render_docbook_xml_to_pdf_by_apache_fop/' rel='bookmark' title='使用Apache FOP将Docbook文档转换成PDF'>使用Apache FOP将Docbook文档转换成PDF</a></li>
<li><a href='http://easwy.com/blog/archives/remove-duplicate-word-with-awk/' rel='bookmark' title='使用awk去掉重复的单词'>使用awk去掉重复的单词</a></li>
<li><a href='http://easwy.com/blog/archives/xlink-href-can-not-generate-hyperlink/' rel='bookmark' title='xlink:href不能生成html超链接'>xlink:href不能生成html超链接</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    在<a class="ulink" href="http://easwy.com/blog/archives/render_docbook_xml_to_pdf_by_apache_fop/" target="_top">使用Apache FOP将Docbook文档转换成PDF</a>一文中，Easwy介绍了在Debian Linux上使用Apache FOP将Docbook文档转换成PDF文件。本来在那篇文章之后，<a class="ulink" href="http://easwy.com/" target="_top">Easwy</a>想写一篇如何在Windows上配置Apache FOP的文章，不过一直没抽出时间。今天刚好有网友问这个问题，于是教她一步步做下来，把步骤列在下面。
  </p>
<p>
    你可以在这里下载到文章中<a class="ulink" href="http://easwy.com/" target="_top">Easwy</a>用到的所有文件：<a class="ulink" href="http://easwy.com/blog/uploads/2010/08/easwy.zip" target="_top">点此下载</a>
  </p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
      <span class="bold"><strong>安装Docbook样式表和xsltproc程序</strong></span></p>
<p>
        按照文章<a class="ulink" href="http://easwy.com/blog/archives/a-simple-docbook-5-example/" target="_top">一个简单的Docbook 5.0例子</a>，安装Docbook样式表和xsltproc转换程序，并能够成功将Docbook文件转换成html格式。
      </p>
</li>
<li class="listitem">
      <span class="bold"><strong>安装Apache FOP和Java虚拟机</strong></span></p>
<p>
        到<a class="ulink" href="http://www.apache.org/dyn/closer.cgi/xmlgraphics/fop" target="_top">Apache Download Mirrors</a>下载Apache FOP，Easwy下载的是FOP 1.0。下载后，将下载的文件解压，<a class="ulink" href="http://easwy.com/" target="_top">Easwy</a>把它解压到C:\docbook\fop-1.0。
      </p>
<p>
        接下来，还要安装Java虚拟机，因为Apache FOP需要Java虚拟机才能运行。到<a class="ulink" href="http://www.java.com/zh_CN/download/" target="_top">Java网站</a>下载安装即可。
      </p>
</li>
<li class="listitem">
      <span class="bold"><strong>设置Apache FOP</strong></span></p>
<p>
        我们需要配置Apache FOP进行PDF转换时所用到的字体信息。首先，用下面的命令把字体信息从Windows自带的系统字体中提取出来：
      </p>
<pre class="programlisting">
cd C:\docbook\fop-1.0
mkdir fonts
java -cp build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\commons-logging-1.0.4.jar;lib\commons-io-1.3.1.jar;lib\xmlgraphics-commons-1.4.jar org.apache.fop.fonts.apps.TTFReader -ttcname SimSun c:\windows\fonts\simsun.ttc fonts\simsun.xml
java -cp build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\commons-logging-1.0.4.jar;lib\commons-io-1.3.1.jar;lib\xmlgraphics-commons-1.4.jar org.apache.fop.fonts.apps.TTFReader -ttcname SimHei c:\windows\fonts\simhei.ttf fonts\simhei.xml </pre>
<p>
        上面的命令，把<span class="emphasis"><em>C:\Windows\fonts\</em></span>目录下的宋体和黑体这两种字体信息提取到<span class="emphasis"><em>fonts\simsun.xml</em></span>和<span class="emphasis"><em>fonts\simhei.xml</em></span>文件中。
      </p>
<p>        接下来配置<span class="bold"><strong>C:\docbook\fop-1.0\conf\fop.xconf</strong></span>，使Apache FOP能够找到这两种字体。首先在文件中找到<span class="emphasis"><em>&lt;renderer mime=”application/pdf”&gt;</em></span>这一行，然后在此标签中加入关于字体的配置。
      </p>
<pre class="programlisting">

&lt;fonts&gt;
  &lt;font metrics-url="fonts/simsun.xml" kerning="yes" embed-url="file:///c:/windows/fonts/simsun.ttc"&gt;
    &lt;font-triplet name="SimSun" style="normal" weight="normal"/&gt;
    &lt;font-triplet name="SimSun" style="normal" weight="bold"/&gt;
    &lt;font-triplet name="SimSun" style="italic" weight="normal"/&gt;
    &lt;font-triplet name="SimSun" style="italic" weight="bold"/&gt;
  &lt;/font&gt;

  &lt;font metrics-url="fonts/simhei.xml" kerning="yes" embed-url="file:///c:/windows/fonts/simhei.ttf"&gt;
    &lt;font-triplet name="SimHei" style="normal" weight="normal"/&gt;
    &lt;font-triplet name="SimHei" style="normal" weight="bold"/&gt;
    &lt;font-triplet name="SimHei" style="italic" weight="normal"/&gt;
    &lt;font-triplet name="SimHei" style="italic" weight="bold"/&gt;
  &lt;/font&gt;

  &lt;directory recursive="true"&gt;file:///c:/windows/fonts/&lt;/directory&gt;

  &lt;auto-detect/&gt;
&lt;/fonts&gt;
         </pre>
</li>
<li class="listitem">
      <span class="bold"><strong>配置XLT转换样式表</strong></span></p>
<p>
        接下来，我们要配置XSL转换样式表，让xsltproc在转换Docbook文档时，使用我们指定的中文字体。在下面我给出了一个简单的样式表，假设存为docbook_fo.xsl：
      </p>
<pre class="programlisting">
&lt;?xml version='1.0'?&gt;
&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common"
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
  xmlns:ng="http://docbook.org/docbook-ng"
  xmlns:db="http://docbook.org/ns/docbook"
  exclude-result-prefixes="db ng exsl"
  version='1.0'&gt;

  &lt;xsl:import href="C:/docbook/docbook-xsl-1.74.3/fo/docbook.xsl"/&gt;
  &lt;xsl:param name="body.font.family"&gt;SimSun&lt;/xsl:param&gt;

  &lt;xsl:param name="monospace.font.family"&gt;SimSun&lt;/xsl:param&gt;
  &lt;xsl:param name="title.font.family"&gt;SimHei&lt;/xsl:param&gt;
&lt;/xsl:stylesheet&gt;
         </pre>
<p>
        在这个转换样式表里，首先导入了Docbook的FO样式表，然后重新设置了其中的字体参数，改成我们所要的字体名称。需要注意的是，这里的字体名字需要和<span class="emphasis"><em>fop.xconf</em></span>中设置的font-triplet中的名字完全一致。
      </p>
</li>
<li class="listitem">
      <span class="bold"><strong>输出PDF文件</strong></span></p>
<p>
        完成上述配置后，就可以进行PDF文件的转换了。把下面的文件保存为<span class="emphasis"><em>example.xml</em></span>：
      </p>
<pre class="programlisting">

&lt;?xml version='1.0' encoding="utf-8"?&gt;

&lt;article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN"
  xmlns:xlink='http://www.w3.org/1999/xlink'&gt;
  &lt;articleinfo&gt;
    &lt;title&gt;我的第一篇Docbook 5.0文档&lt;/title&gt;
    &lt;author&gt;
      &lt;firstname&gt;Easwy&lt;/firstname&gt;

      &lt;surname&gt;Yang&lt;/surname&gt;
    &lt;/author&gt;
  &lt;/articleinfo&gt; 

  &lt;section&gt;
    &lt;title&gt;文档介绍&lt;/title&gt;

    &lt;para&gt;
      这是我的第一篇Docbook 5.0文档，欢迎你来到&lt;link xlink:href='http://easwy.com/blog/'&gt;Easwy的博客&lt;/link&gt;。
    &lt;/para&gt;
  &lt;/section&gt;
&lt;/article&gt;
         </pre>
<p>
        然后输入下面的命令将其转换成PDF：
      </p>
<pre class="programlisting">
xsltproc -o example.fo c:\docbook\fop-1.0\conf\docbook_fo.xsl example.xml
fop -c c:\docbook\fop-1.0\conf\fop.xconf example.fo -pdf example.pdf </pre>
</li>
</ol>
</div>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>参考文档</strong></span></p>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem">
      <a class="ulink" href="http://xmlgraphics.apache.org/fop/0.95/configuration.html" target="_top">Apache FOP: Configuration</a></p>
</li>
<li class="listitem">
      <a class="ulink" href="http://xmlgraphics.apache.org/fop/0.95/fonts.html" target="_top">Apache FOP: Fonts</a>
    </li>
<li class="listitem">
      <a class="ulink" href="http://blog.chinaunix.net/u/1096/showart.php?id=1808039" target="_top">使用Apache FOP将Docbook转换成PDF文档</a>
    </li>
<li class="listitem">
      <a class="ulink" href="http://gentoogle.blogspot.com/2008/03/docbookpdf.html" target="_top">中文docbook转换成PDF终于实现</a>
    </li>
<li class="listitem">
<p>      <a class="ulink" href="http://blog.donews.com/limodou/archive/2004/04/01/9917.aspx" target="_top">使用FOP将中文DocBook xml转换成pdf的实现记录</a>
    </li>
</ul>
</div>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/install-apache-fop-on-windows/" target="_top">http://easwy.com/blog/archives/install-apache-fop-on-windows/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/render_docbook_xml_to_pdf_by_apache_fop/' rel='bookmark' title='使用Apache FOP将Docbook文档转换成PDF'>使用Apache FOP将Docbook文档转换成PDF</a></li>
<li><a href='http://easwy.com/blog/archives/remove-duplicate-word-with-awk/' rel='bookmark' title='使用awk去掉重复的单词'>使用awk去掉重复的单词</a></li>
<li><a href='http://easwy.com/blog/archives/xlink-href-can-not-generate-hyperlink/' rel='bookmark' title='xlink:href不能生成html超链接'>xlink:href不能生成html超链接</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/install-apache-fop-on-windows/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记：Linux下动态链接库配置</title>
		<link>http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/</link>
		<comments>http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 06:16:52 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[嵌入系统]]></category>
		<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1020</guid>
		<description><![CDATA[ 当Easwy尝试telent一个远端设备(ssh也遇到同样的错误)时，遇到下面的提示：

/usr/local/bin/cli: error while loading shared libraries: libAbc.so: cannot open shared object file: No such file or directory 
... <a href="http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/enable-ip-forward-on-linux/' rel='bookmark' title='Linux使用笔记: 在Linux中使能IP转发'>Linux使用笔记: 在Linux中使能IP转发</a></li>
<li><a href='http://easwy.com/blog/archives/disable-ipv6-in-centos-and-redhat/' rel='bookmark' title='Linux使用笔记：在CentOS 5中关闭IPv6'>Linux使用笔记：在CentOS 5中关闭IPv6</a></li>
<li><a href='http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/' rel='bookmark' title='Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题'>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    当<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>尝试telent一个远端设备时，遇到下面的提示(ssh也遇到同样的错误)：
  </p>
<pre class="programlisting">
/usr/local/bin/cli: error while loading shared libraries: libAbc.so: cannot open shared object file: No such file or directory </pre>
<p>
    在这个设备里，由<span class="command"><strong>xinetd</strong></span>来启动<span class="command"><strong>in.telnetd</strong></span>，而<span class="command"><strong>in.telnetd</strong></span>则调用<span class="command"><strong>/usr/local/bin/cli</strong></span>来做为登录程序。看上述提示，应该是<span class="command"><strong>in.telnetd</strong></span>在启动<span class="command"><strong>/usr/local/bin/cli</strong></span>时找不到动态链接库。
  </p>
<p>
    首先用<span class="command"><strong>ldd</strong></span>命令查看一下<span class="command"><strong>/usr/local/bin/cli</strong></span>所使用的动态链接库：
  </p>
<pre class="programlisting">
$ ldd /usr/local/bin/cli
linux-vdso32.so.1 =  (0x00100000)
libAbc.so =&gt; /usr/local/lib/libAbc.so (0x0fdfc000)
libreadline.so.5 =&gt; /lib/libreadline.so.5 (0x0f376000)
libncurses.so.5 =&gt; /lib/libncurses.so.5 (0x0f337000)
libstdc++.so.6 =&gt; /lib/libstdc++.so.6 (0x0f24e000)
libm.so.6 =&gt; /lib/libm.so.6 (0x0f17a000)
libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0x0f14a000)
/lib/ld.so.1 (0x48000000)
libtinfo.so.5 =&gt; /lib/libtinfo.so.5 (0x0efaa000)&gt; </pre>
<p>
    从上面的命令输出可以看到，<span class="command"><strong>cli</strong></span>程序的确会调用libAbc.so这个库，不过上面的输出中，这个库已经被找到了，它对应着文件/usr/local/lib/libAbc.so。考虑到在shell中已经设置了<span class="emphasis"><em>LD_LIBRARY_PATH</em></span>环境变量，在此环境变量中增加了<span class="emphasis"><em>/usr/local/lib</em></span>目录，那么是不是xinetd在启动in.telnetd时没有传递此环境变量呢？
  </p>
<p>
    于是修改<span class="emphasis"><em>/etc/xinetd.d/telnet</em></span>，在里面增加一行：
  </p>
<pre class="programlisting">
env = LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib </pre>
<p>
    再次telnet，还是显示上述错误。似乎是in.telnetd在启动cli时没有传递上述环境变量。
  </p>
<p>
    幸好还有一个方法来指定动态链接库的位置。
  </p>
<p>
    <a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>在目录<span class="emphasis"><em>/etc/ld.so.conf.d</em></span>中新增加一个文件<span class="emphasis"><em>cli.conf</em></span>，内容是：
  </p>
<pre class="programlisting">
$  cat cli.conf
/usr/local/lib </pre>
<p>
    然后再以root身份执行一下<span class="command"><strong>ldconfig</strong></span>命令。现在再telnet或ssh，就不会出现上述错误提示了。
  </p>
<p>
    <span class="command"><strong>/usr/ldconfig</strong></span>命令会读取命令行参数、<span class="emphasis"><em>/etc/ld.so.conf</em></span>配置文件以及/lib和/usr/lib目录，为动态链接器<span class="command"><strong>ld.so</strong></span>和<span class="command"><strong>ld-linux.so</strong></span>生成所需的链接和缓存信息。也就是说，如果不修改任何配置，只有位于/lib和/usr/lib目录的库才能被动态链接器使用。<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>上面的修改新增了<span class="emphasis"><em>/usr/local/lib</em></span>目录，并且使用<span class="command"><strong>/sbin/ldconfig</strong></span>命令重新生成了缓存，使动态链接器可以引用上述目录的库。这样就解决了此问题。
  </p>
<p>
    因此，在你也遇到类似的错误时，如果有root权限，就可以用这种方法来解决；如果没有root权限，那就只能设置一下<span class="command"><strong>LD_LIBRARY_PATH</strong></span>环境变量了。
  </p>
<p>
    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/" target="_top">http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/enable-ip-forward-on-linux/' rel='bookmark' title='Linux使用笔记: 在Linux中使能IP转发'>Linux使用笔记: 在Linux中使能IP转发</a></li>
<li><a href='http://easwy.com/blog/archives/disable-ipv6-in-centos-and-redhat/' rel='bookmark' title='Linux使用笔记：在CentOS 5中关闭IPv6'>Linux使用笔记：在CentOS 5中关闭IPv6</a></li>
<li><a href='http://easwy.com/blog/archives/solve-fragment-packets-loss-of-ping/' rel='bookmark' title='Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题'>Linux使用笔记: 解决Xen虚拟机中VLAN接口不能ping大包的问题</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/dynamic_library_configuration_in_linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows下cscope -q选项出错的解决</title>
		<link>http://easwy.com/blog/archives/cscope_sort_option_on_windows/</link>
		<comments>http://easwy.com/blog/archives/cscope_sort_option_on_windows/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 02:50:07 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开发编程]]></category>
		<category><![CDATA[开源软件]]></category>
		<category><![CDATA[文本处理]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1021</guid>
		<description><![CDATA[ 以前曾有网友留言，在windows下使用cscope时，使用-q选项出现如下提示：

D:\Temp> cscope -Rbkq
Input file specified two times.

cscope: cannot create inverted index; ignoring -q option
cscope: removed files ncscope.in.out and ncscope.po.out 

当时Easwy以为是windows版本的cscope不支持-q选项。 网友Liang Feng提醒说是由于没有找到合适的sort程序，Easwy又做了一个实验，找到了解决此问题的办法。 <a href="http://easwy.com/blog/archives/cscope_sort_option_on_windows/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/advanced-vim-skills-cscope/' rel='bookmark' title='vi/vim使用进阶: 程序员的利器 &#8211; cscope'>vi/vim使用进阶: 程序员的利器 &#8211; cscope</a></li>
<li><a href='http://easwy.com/blog/archives/vim-cscope-ctags/' rel='bookmark' title='vi/Vim + Cscope/Ctags'>vi/Vim + Cscope/Ctags</a></li>
<li><a href='http://easwy.com/blog/archives/install-cscope-to-home/' rel='bookmark' title='如何将cscope安装到指定目录'>如何将cscope安装到指定目录</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    以前曾有网友留言，在windows下使用cscope时，使用-q选项出现如下提示：
  </p>
<pre class="programlisting">
D:\Temp&gt; cscope -Rbkq
Input file specified two times.

cscope: cannot create inverted index; ignoring -q option
cscope: removed files ncscope.in.out and ncscope.po.out </pre>
<p>
    当时<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>以为是windows版本的cscope不支持-q选项。
  </p>
<p>
    不过网友Liang Feng昨天<a class="ulink" href="http://easwy.com/blog/archives/advanced-vim-skills-cscope/#comment-2116" target="_top">留言</a>说：
  </p>
<pre class="programlisting">
Windows版本的cscope是支持-q选项的，出现以上错误是因为没找到合适的sort命令。所以只要cscope进程的工作目录下有GNU版本的sort就可以了。注意是进程的工作目录，不是可执行程序的目录。具体原因看一下cscope的代码片段。

build.c

#ifdef WIN32
snprintf(sortcommand, sizeof(sortcommand), “set LC_ALL=C &amp;&amp; sort -T %s %s”, tmpdir, temp1);
#else
snprintf(sortcommand, sizeof(sortcommand), “env LC_ALL=C sort -T %s %s”, tmpdir, temp1);
#endif </pre>
<p>
    于是重新做了一下试验。在安装了Cygwin后，在cygwin的shell界面中使用cscope，没有出现上面的错误提示。但如果打开windows的命令行窗口cmd.exe，在里面执行cscope，则会出现上面的错误。
  </p>
<p>
    在仔细比较了cygwin和cmd.exe的环境后发现，原来是Windows自带的sort.exe搞的鬼。
  </p>
<p>
    在cygwin的shell窗口中，PATH环境变量的设置会使其先找到GNU版的sort.exe，所以上述cscope命令执行可以成功。但在cmd.exe窗口中，PATH环境变量会使其先找到windows自带的sort.exe而不是GNU sort.exe，所以会出现上面的错误提示。
  </p>
<p>
    知道了问题的原因，解决方法就很简单了，我们可以写一个批处理程序，在此程序中重设PATH环境变量，使cscope使用GNU版的sort.exe。示例程序如下：
  </p>
<pre class="programlisting">
D:\Temp&gt; type cs.bat
@echo off
set path=c:\cygwin\bin;
cscope -Rbkq </pre>
<p>
    在这个批处理里，首先把path环境变量指向<span class="emphasis"><em>c:\cygwin\bin;</em></span>，我的cscope.exe和GNU版的sort.exe都在此目录中。接下来现执行cscope命令，现在它使用的就是GNU版的sort.exe了。
  </p>
<p>
    在此感谢网友Liang Feng，谢谢他的提醒。
  </p>
<p>    更多内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
  </p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/cscope_sort_option_on_windows/" target="_top">http://easwy.com/blog/archives/cscope_sort_option_on_windows/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/advanced-vim-skills-cscope/' rel='bookmark' title='vi/vim使用进阶: 程序员的利器 &#8211; cscope'>vi/vim使用进阶: 程序员的利器 &#8211; cscope</a></li>
<li><a href='http://easwy.com/blog/archives/vim-cscope-ctags/' rel='bookmark' title='vi/Vim + Cscope/Ctags'>vi/Vim + Cscope/Ctags</a></li>
<li><a href='http://easwy.com/blog/archives/install-cscope-to-home/' rel='bookmark' title='如何将cscope安装到指定目录'>如何将cscope安装到指定目录</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/cscope_sort_option_on_windows/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>vi技巧: 宏的使用技巧</title>
		<link>http://easwy.com/blog/archives/vi-tip-of-using-recording/</link>
		<comments>http://easwy.com/blog/archives/vi-tip-of-using-recording/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 11:38:16 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1011</guid>
		<description><![CDATA[网友Karl问：
    再请教一下：我想在.vimrc中设置一个宏，请vi启动的时候就有这个宏，应该怎么办？ 
其实在vim中所谓的宏就是把一串命令放到了指定的寄存器里。所以要实现Karl的需求，可以这样做：先录制好宏后，然后在vimrc里把这个宏中的命令放到指定寄存器里，这样vim启动后就可以直接使用这个宏了。
具体的做法如下... <a href="http://easwy.com/blog/archives/vi-tip-of-using-recording/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/' rel='bookmark' title='Easwy的vim配置共享：包括.vimrc及整个.vim目录'>Easwy的vim配置共享：包括.vimrc及整个.vim目录</a></li>
<li><a href='http://easwy.com/blog/archives/vim-mail-list-discussion-group/' rel='bookmark' title='vim邮件列表和论坛资源'>vim邮件列表和论坛资源</a></li>
<li><a href='http://easwy.com/blog/archives/compile-vim73-on-ubuntu/' rel='bookmark' title='在Ubuntu上编译vim 7.3'>在Ubuntu上编译vim 7.3</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    本文所用命令的帮助入口：
  </p>
<pre class="programlisting">
:help q
:help @
:help :let-@ </pre>
<p>
    <a class="ulink" href="http://easwy.com/blog/archives/where-is-vimrc/#comment-1885" target="_top">网友Karl问</a>：
  </p>
<div class="blockquote">
<blockquote class="blockquote">
再请教一下：我想在.vimrc中设置一个宏，请vi启动的时候就有这个宏，应该怎么办？
  </p></blockquote>
</div>
<p>
    其实在vim中所谓的宏就是把一串命令放到了指定的寄存器里。所以要实现Karl的需求，可以这样做：先录制好宏后，然后在vimrc里把这个宏中的命令放到指定寄存器里，这样vim启动后就可以直接使用这个宏了。
  </p>
<p>
    具体的做法如下：
  </p>
<p>
    <span class="bold"><strong>第一步：</strong></span>首先录制宏，<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>以插入三行文字做为一个简单的例子。这三行文字是：
  </p>
<pre class="programlisting">
================================
I love vim. Happy vimming!
================================ </pre>
<p>
    按<span class="command"><strong>qu</strong></span>开始录制，录制完成后再按一个<span class="command"><strong>q</strong></span>命令结束，这样就把宏录制到寄存器<span class="emphasis"><em>u</em></span>中了。
  </p>
<p>    现在我们可以查看一下<span class="emphasis"><em>u</em></span>寄存器的内容，用命令<span class="command"><strong>“up</strong></span>，把u寄存器的内容粘贴出来：
  </p>
<pre class="programlisting">
32i=^[oI love vim. Happy vimming!^M^[32i=^[ </pre>
<p>
    注意，上面的<span class="bold"><strong>^[</strong></span>实际上是<span class="bold"><strong>&lt;ESC&gt;</strong></span>键的键码，同样，<span class="bold"><strong>^M</strong></span>是换行键<span class="bold"><strong>&lt;CR&gt;</strong></span>的键码，在vim中它们以特殊的颜色被显示出来，如果你把光标在它们上面移过，你会发现它们虽被显示成两个字符，但实际上只是一个。
  </p>
<p>
    <span class="bold"><strong>第二步：</strong></span>现在我们用下面的命令在<a class="ulink" href="http://easwy.com/blog/archives/advanced-vim-skills-introduce-vimrc/" target="_top">.vimrc</a>中输入一行：
  </p>
<pre class="programlisting">
&lt;ESC&gt;olet @m = "&lt;ESC&gt;"upa"&lt;ESC&gt; </pre>
<p>
    这行命令实际上在.vimrc加入了这行话：
  </p>
<div class="blockquote">
<blockquote class="blockquote">
let @m = "32i=^[oI love vim. Happy vimming!^M^[32i=^["
  </p></blockquote>
</div>
<p>
    <span class="bold"><strong>第三步：</strong></span>现在你重启vi，然后直接输出下面的命令：
  </p>
<pre class="programlisting">
@m </pre>
<p>
    怎么样，宏是不是生效了？！
  </p>
<p>
  要想了解更多细节，请阅读文章开始处给出的帮助手册。
</p>
<p>
  更多关于vi/vim的内容，请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">易水博客</a>上的其它文章。
</p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/vi-tip-of-using-recording/" target="_top">http://easwy.com/blog/archives/vi-tip-of-using-recording/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/easwy-vimrc-and-vim-settings/' rel='bookmark' title='Easwy的vim配置共享：包括.vimrc及整个.vim目录'>Easwy的vim配置共享：包括.vimrc及整个.vim目录</a></li>
<li><a href='http://easwy.com/blog/archives/vim-mail-list-discussion-group/' rel='bookmark' title='vim邮件列表和论坛资源'>vim邮件列表和论坛资源</a></li>
<li><a href='http://easwy.com/blog/archives/compile-vim73-on-ubuntu/' rel='bookmark' title='在Ubuntu上编译vim 7.3'>在Ubuntu上编译vim 7.3</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/vi-tip-of-using-recording/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Linux下常用程序的代理服务器(proxy)配置</title>
		<link>http://easwy.com/blog/archives/proxy-setting-on-linux-console/</link>
		<comments>http://easwy.com/blog/archives/proxy-setting-on-linux-console/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 04:26:17 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=1001</guid>
		<description><![CDATA[Linux下有很多程序都只有命令行接口，对于这类程序，它们通过代理服务器(proxy)访问网络的方式也不尽相同。在本文中Easwy总结了一些常用Linux程序配置代理服务器的方法。  <a href="http://easwy.com/blog/archives/proxy-setting-on-linux-console/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/use_http_proxy_for_git/' rel='bookmark' title='Linux使用笔记: 使用代理服务器访问git版本库'>Linux使用笔记: 使用代理服务器访问git版本库</a></li>
<li><a href='http://easwy.com/blog/archives/use-rxvt-in-cygwin/' rel='bookmark' title='使用rxvt做为cygwin终端'>使用rxvt做为cygwin终端</a></li>
<li><a href='http://easwy.com/blog/archives/linux-remote-desktop-via-cygwin-x-server/' rel='bookmark' title='使用cygwin X server实现Linux远程桌面 (for windows)'>使用cygwin X server实现Linux远程桌面 (for windows)</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    Linux下有很多程序都只有命令行接口，对于这类程序，它们通过代理服务器(proxy)访问网络的方式也不尽相同。在本文中<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>总结了一些常用Linux程序配置代理服务器的方法。
  </p>
<p><span class="bold"><strong>[ 通用代理服务器配置 ]</strong></span></p>
<p>
    对于大多数Linux控制台程序，例如<a class="ulink" href="http://easwy.com/blog/archives/tag/debian/" target="_top">Debian</a>或Ubuntu中的<span class="command"><strong>apt-get</strong></span>和<span class="command"><strong>aptitude</strong></span>命令、<a class="ulink" href="http://easwy.com/blog/archives/use_http_proxy_for_git/" target="_top">git命令</a>、wget命令，这些程序都使用<span class="emphasis"><em>http_proxy</em></span>和<span class="emphasis"><em>ftp_proxy</em></span>环境变量来获取代理服务的配置。
  </p>
<p>
    方法是在你的~/.bashrc里加上类似下面的话：
  </p>
<pre class="programlisting">
export http_proxy=http://username:password@proxyserver:port/
export ftp_proxy=http://username:password@proxyserver:port/ </pre>
<p>
    如果你的代理服务器需要用户名和密码才能访问，需要填写上面的username和passwd部分，否则的话，省略这两部分。
  </p>
<p>
    例如，假设你的代理服务器为<span class="emphasis"><em>192.168.1.1</em></span>，端口是<span class="emphasis"><em>8080</em></span>，用户名为<span class="emphasis"><em>easwy</em></span>，密码是<span class="emphasis"><em>123456</em></span>，那么应该这样设置这两个环境变量：
  </p>
<pre class="programlisting">
export http_proxy=http://easwy:123456@192.168.1.1:8080
export ftp_proxy=http://easwy:123456@192.168.1.1:8080 </pre>
<p>
    这样配置之后，退出再登录一次，或者直接使用下面的命令source一下.bashrc：
  </p>
<pre class="programlisting">source ~/.bashrc</pre>
<p>
    现在，上述程序就可以通过代理服务器访问网络了。
  </p>
<p><span class="bold"><strong>[ subversion的代理服务器配置 ]</strong></span></p>
<p>
    要配置subversion的代理服务器，需要修改<span class="emphasis"><em>$HOME/.subversion/servers</em></span>文件，在此文件的<span class="emphasis"><em>[global]</em></span>段加上：
  </p>
<pre class="programlisting">
http-proxy-host = 192.168.1.1
http-proxy-port = 8080
http-proxy-username = <a href="http://easwy.com/">easwy</a>
http-proxy-password = 123456 </pre>
<p>    现在<span class="command"><strong>svn</strong></span>就可以使用代理服务器访问版本库了。
  </p>
<p><span class="bold"><strong>[ yum的代理服务器配置 ]</strong></span></p>
<p>
    如果想让CentOS中的<span class="command"><strong>yum</strong></span>可以通过代理服务器更新程序，则需要修改文件<span class="emphasis"><em>/etc/yum.conf</em></span>，在此文件中加上：
  </p>
<p>
proxy=http://easwy:123456@192.168.1.1:8080</p>
<p>
    现在使用<span class="command"><strong>yum</strong></span>就可以更新你的软件了。
  </p>
<div class="posturl">
<p><span class="bold"><strong>原创文章，请阅读页脚的<a href="#license">许可方式</a>，转载请注明：</strong></span>转载自<a class="link" href="http://easwy.com/blog/" target="_top">易水博客</a> [ <a class="link" href="http://easwy.com/blog/" target="_top">http://easwy.com/blog/</a> ]</p>
<p><span class="bold"><strong>本文链接地址:</strong></span> <a class="link" href="http://easwy.com/blog/archives/proxy-setting-on-linux-console/" target="_top">http://easwy.com/blog/archives/proxy-setting-on-linux-console/</a></p>
</div>
<p style="margin-top: 0; margin-bottom: 15px; color: #888888; font-size: 80%; font-style: italic">文章的脚注信息由WordPress的<a href="http://easwy.com/blog/wordpress/wp-posturl/" style="color: #8888FF; text-decoration: underline;">wp-posturl插件</a>自动生成</p>
<div class="fixed"></div><div id="related_posts"><h3  class="related_post_title">相关文章</h3><ul class="related_post">
<li><a href='http://easwy.com/blog/archives/use_http_proxy_for_git/' rel='bookmark' title='Linux使用笔记: 使用代理服务器访问git版本库'>Linux使用笔记: 使用代理服务器访问git版本库</a></li>
<li><a href='http://easwy.com/blog/archives/use-rxvt-in-cygwin/' rel='bookmark' title='使用rxvt做为cygwin终端'>使用rxvt做为cygwin终端</a></li>
<li><a href='http://easwy.com/blog/archives/linux-remote-desktop-via-cygwin-x-server/' rel='bookmark' title='使用cygwin X server实现Linux远程桌面 (for windows)'>使用cygwin X server实现Linux远程桌面 (for windows)</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/proxy-setting-on-linux-console/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

