<?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; debian</title>
	<atom:link href="http://easwy.com/blog/archives/tag/debian/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>解决Thinkpad T400在Debian Linux下不能休眠/待机的问题</title>
		<link>http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/</link>
		<comments>http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 07:54:54 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=989</guid>
		<description><![CDATA[ 在Thinkpad T400上安装了Debian Lenny后，发现电源管理似乎有点问题，系统不能正常的进入休眠/待机状态。当笔记本长时间处于Idle状态时，并不能进入待机或休眠状态，Gnome电源管理程序出现下面的提示：

Sleep Problem
Your computer failed to suspend/hibernate.
Check the help file for common problems.  

在Google上搜索了一下，其它Thinkpad T400的用户可以在Linux下正常待机或者休眠(Suspend/Hibernate)，看来应该是自己笔记本配置问题。  <a href="http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置Thinkpad T400的声卡'>在Debian Lenny中配置Thinkpad T400的声卡</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    在<a class="link" href="http://easwy.com/blog/archives/debian-lenny-installation-on-thinkpad-t400/">Thinkpad T400上安装了Debian Lenny</a>后，发现电源管理似乎有点问题，系统不能正常的进入休眠/待机状态。当笔记本长时间处于Idle状态时，并不能进入待机或休眠状态，Gnome电源管理程序出现下面的提示：
  </p>
<pre class="programlisting">
Sleep Problem
Your computer failed to suspend/hibernate.
Check the help file for common problems.  </pre>
<p>
    在Google上搜索了一下，其它Thinkpad T400的用户可以在Linux下正常待机或者休眠(Suspend/Hibernate)，看来应该是自己笔记本配置问题。
  </p>
<p>    Linux上的电源管理由<a class="link" href="http://pm-utils.freedesktop.org/wiki/">pm-utils</a>实现，这个工具箱里包含了几个脚本:<span class="command"><strong>pm-hibernate</strong></span>、<span class="command"><strong>pm-suspend</strong></span>和<span class="command"><strong>pm-suspend-hybrid</strong></span>。这些脚本一般由窗口管理器Gnome或KDE，通过hald守护进程来调用。当然也可以直接调用这些脚本。<a class="link" href="http://easwy.com/blog/">Easwy</a>首先使用root用户执行<span class="command"><strong>pm-hibernate</strong></span>：
  </p>
<pre class="programlisting">
sudo pm-hibernate </pre>
<p>    执行完这个命令后，笔记本就将内存镜像保存到磁盘上，然后进入休眠模式。既然root用户能切换到休眠模式，那应该是Gnome的登录用户easwy不具备相应的权限。根据参考文档一中的说明，把用户<a class="link" href="http://easwy.com/blog/">easwy</a>加入<span class="emphasis"><em>powerdev</em></span>组中，现在在Gnome Power Manager中选择<span class="emphasis"><em>hibernate</em></span>就可以使计算机中进入休眠状态，不会出现上面的提示。
  </p>
<p>
    但新的问题又出现了，T400进入待机或休眠模式后无法正常恢复回来。现象是在恢复时，图形界面显示不完整，这时鼠标键盘都没有反应，过一段时间T400就重新加电重启了。
  </p>
<p>
    在网上搜了一下，好像这是由于xf86-video-intel驱动与芯片的兼容性问题(见参考文档二)造成的，使用下面的脚本可以解决这个问题：
  </p>
<pre class="programlisting">

#!/bin/sh
# Workaround for concurrency bug in xserver-xorg-video-intel 2:2.4.1-1ubuntu10.
# Save this as /etc/pm/sleep.d/00CPU 

. "/usr/lib/pm-utils/functions"

case "$1" in
	hibernate|suspend)
		for i in /sys/devices/system/cpu/cpu*/online ; do
			echo 0 &gt;$i
		done
		;;
	thaw|resume)
		sleep 10	# run with one core for 10 secs
		for i in /sys/devices/system/cpu/cpu*/online ; do
			echo 1 &gt;$i
		done
		;;
	*)
		;;
esac </pre>
<p>    <a class="link" href="http://easwy.com/blog/">Easwy</a>把上述脚本保存到<span class="emphasis"><em>/etc/pm/sleep.d/00CPU</em></span>，现在，Thinkpad T400可以正常待机/休眠/恢复了。
  </p>
<p>
    更多关于<a class="link" href="http://easwy.com/blog/archives/tag/thinkpad/">Linux上Thinkpad T400</a>的内容，请阅读<a class="link" href="http://easwy.com/blog/">Easwy的博客</a>上的其它文章。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li><a class="link" href="http://old.nabble.com/Help-with-suspend-hibernate-in-Gnome-Power-Manager-td15181122.html">Help with suspend/hibernate in Gnome Power Manager</a></li>
<li><a class="link" href="http://wiki.archlinux.org/index.php/Lenovo_ThinkPad_T400#SUSPEND-RESUME">SUSPEND-RESUME</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/thinkpad-t400-suspend-hibernate-problem-on-linux/" target="_top">http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置Thinkpad T400的声卡'>在Debian Lenny中配置Thinkpad T400的声卡</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/' rel='bookmark' title='在Linux中使用thinkpad的小红点+中键'>在Linux中使用thinkpad的小红点+中键</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/thinkpad-t400-suspend-hibernate-problem-on-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Linux使用笔记: 实用ext3grep恢复目录及文件指南(ext3文件系统)</title>
		<link>http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/</link>
		<comments>http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 02:46:10 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=979</guid>
		<description><![CDATA[ 一个同事不小心使用rm -rf命令误删了自己的代码，这意味着一个月的工作丢失了。我们知道rm命令无法撤销，那么有没有办法恢复这个被删除的目录以及其中的全部文件呢？
在网上搜索了一下，找到一个名为ext3grep的工具，本文介绍如何通过ext3grep来恢复目录和文件... <a href="http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/">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/change-rpm-package-installation-directories/' rel='bookmark' title='Linux使用笔记: 更改RPM包的安装目录'>Linux使用笔记: 更改RPM包的安装目录</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/switch-to-single-user-mode-in-grub/' rel='bookmark' title='Linux使用笔记: Grub中进入单用户模式的方法'>Linux使用笔记: Grub中进入单用户模式的方法</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    一个同事不小心使用<span class="command"><strong>rm -rf</strong></span>命令误删了自己的代码，这意味着一个月的工作丢失了(一个月没有备份过代码，看来他以前一定没经历计算机崩溃的灾难)。我们知道<span class="command"><strong>rm</strong></span>命令无法撤销，那么有没有办法恢复这个被删除的目录以及其中的全部文件呢？
  </p>
<p>
    在网上搜索了一下，找到一个名为ext3grep的工具，以及它的作者的一篇文章(见<span class="bold"><strong>参考文档</strong></span>）。在这个工具出现以前，恢复ext3文件系统中被删除的数据是不可能的。因为ext3文件系统不同于ext2文件系统，它在删除一个文件后，会把文件inode结点中扇区指针清为0，而这让文件恢复看起来不太可能。不过，正如ext3grep工具作者所说的，因为ext3是一个日志型的文件系统，通过分析日志信息，有很大的可能重新解析出块指针，从而恢复出目录和文件。
  </p>
<p>
    以下是Easwy恢复文件所采用的步骤，希望对大家有帮助。
  </p>
<p><span class="bold"><strong>[ 卸载被误删除文件所在的分区，或以只读方式mount ]</strong></span></p>
<p>
    当你发现你误删除了文件后，要做的第一件事是马上卸载被误删除文件所在的分区，或者以只读的方式来挂载该分区。原因大家都很清楚，文件被删除后，文件中的数据还存在磁盘上，除非存放这些数据的数据块又被操作系统分配出去了。我们这一步就是尽量降低数据块中数据被覆盖的风险，以提高恢复数据成功的比率。
  </p>
<p>
    如果被误删的文件在根分区，那么你最好重启计算机，进入单用户模式，以只读的方式挂载根分区，然后再进行恢复。要进行单用户模式，请看<a class="ulink" href="http://easwy.com/blog/" target="_top">Grub中进入单用户模式的方法</a>。
  </p>
<p>
    进入单用户模式后，根分区还是以读写方式mount的，用下面的命令，把挂载方式由读写(rw)改为只读(ro)：
  </p>
<pre class="programlisting">
mount -o ro,remount / </pre>
<p>
    如果被删除的文件不是根分区，也可以用unmount的方式将该分区卸载。假设文件在分区/dev/sda3中，该分区挂载到/home，那么我们用下面的命令来卸载：
  </p>
<pre class="programlisting">
    umount /dev/sda3 </pre>
<p>
    或者命令：
  </p>
<pre class="programlisting">
    umount /home </pre>
<p>
    当然，在卸载前要保证没有程序在访问该分区，否则卸载会失败。所以，Easwy一般推荐进入单用户模式来恢复文件。
  </p>
<p><span class="bold"><strong>[ 安装ext3grep工具 ]</strong></span></p>
<p>
    恢复的第一步当然是安装ext3grep工具。对于Debian/Ubuntu用户来说，安装ext3grep工具非常简单，只需要执行下面的命令：
  </p>
<pre class="programlisting">
aptitude install ext3grep </pre>
<p>
    不过Easwy公司所使用的Linux版本是Centos，所以需要自己手工编译ext3grep工具，其实这也很简单，首先到<a class="ulink" href="http://code.google.com/p/ext3grep/downloads/list" target="_top">ext3grep主页</a>上下载它的源代码，然后用下面的命令解压/编译/安装这个工具。
  </p>
<pre class="programlisting">

tar zxf ext3grep-0.10.1.tar.gz
cd /home/easwy/ext3grep-0.10.1
./configure
make
make install </pre>
<p>
    <span class="bold"><strong>注：</strong></span>在网上搜了一下，ext3grep也有rpm包可以下载，比如，RHEL/CentOS的RPM包可以在<a class="ulink" href="ftp://194.199.20.114/linux/dag/redhat/el5/en/i386/dag/RPMS/ext3grep-0.10.0-1.el5.rf.i386.rpm" target="_top">这里</a>下载。其它Linux发行版的RPM也可以在<a class="ulink" href="http://www.rpmfind.net/" target="_top">rpmfind.net</a>上找到。
  </p>
<p>
    <a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>前面说过，发现误删除后，要卸载掉该分区，或者进入单用户模式。所以最好在另外一台计算机上来编译或安装这个工具，然后把ext3grep这个可执行文件拷贝到U盘中再进行恢复。这也正是Easwy所用的方法，因为同事的文件恰好在根分区中。如果你也是这种情况，那么在用RPM包安装时，则需要把RPM包安装到你<a class="ulink" href="http://easwy.com/blog/archives/change-rpm-package-installation-directories/" target="_top">你指定的目录</a>中，然后再把它拷贝到U盘中。
  </p>
<p>
    U盘里只需要拷贝ext3grep一个文件即可，它不需要动态加载库就可以执行。接下来把U盘插到待恢复的电脑上，用下面的命令加载：
  </p>
<pre class="programlisting">
mount -t vfat /dev/sdb1 /mnt </pre>
<p>
    把上面的设备号和安装点换成你自己的。如果你的设备文件还不存在的话(这也刚好是Easwy的情况)，用<span class="command"><strong>mknod</strong></span>命令创建一下吧。
  </p>
<p>    现在，我们可以开始文件恢复了。
  </p>
<p><span class="bold"><strong>[ 恢复文件 ]</strong></span></p>
<p>
    在开始恢复前，选择一个目录来存放被恢复的文件。ext3grep程序会在当前目录下创建一个名为<span class="emphasis"><em>RESTORED_FILES</em></span>的目录来存放被恢复的文件。因此在运行ext3grep命令前，先要切换到一个你可读写的目录中。
  </p>
<p>
    对Easwy来讲，因为进入了单用户模式，并且将根分区设成了只读，那么只能把恢复出来的文件放在U盘中了。因此，先<span class="command"><strong>cd /mnt</strong></span>进入U盘目录。
  </p>
<p>
    如果你有幸记得你误删除的文件名及其路径的话，就可以直接用下面的命令进行恢复了：
  </p>
<pre class="programlisting">
    ext3grep /dev/your-device --restore-file path/to/your/file/filename </pre>
<p>
    需要注意的是，上面的文件路径，是在该分区上文件路径。假设我们要恢复<span class="emphasis"><em>/dev/sda3</em></span>分区上文件，这个分区原来的安装点是<span class="emphasis"><em>/home</em></span>，现在想恢复文件<span class="emphasis"><em>/home/easwy/vi/tips.xml</em></span>，那么输入的命令应该是：
  </p>
<pre class="programlisting">
    ext3grep /dev/sda3 --restore-file easwy/vi/tips.xml </pre>
<p>
    如果你忘记了文件名，或者你误删除的是一个目录而你无法记全该目录中的文件，你可以先用下面的命令查询一下文件名：
  </p>
<pre class="programlisting">
ext3grep /dev/sda3 --dump-names | tee filename.txt</pre>
<p>
    上面的命令把ext3grep命令的输出记录到文件<span class="emphasis"><em>filename.txt</em></span>中，你可以慢慢查看，或者使用<span class="command"><strong>grep</strong></span>命令过滤出你需要的信息。
  </p>
<p>
    当你知道了目录/文件的信息后，就可以用上面说的命令进行恢复了。
  </p>
<p>
    在ext3grep命令中有一个<span class="emphasis"><em>&#8211;depth</em></span>参数，应该是用来恢复目录以及其中的所有子目录和文件的，不过<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy</a>用这个参数无法恢复出任何文件，只好采用笨办法，写了个脚本，一个个文件的恢复。
  </p>
<p>
    经过几个小时的折磨(中间走了一些弯路)，同事的文件终于恢复成功了！
  </p>
<p>
    请阅读<a class="ulink" href="http://easwy.com/blog/" target="_top">Easwy的博客</a>上的其它文章获取更多信息。
  </p>
<p><span class="bold"><strong>[ 参考文档 ]</strong></span></p>
<div class="itemizedlist">
<ul type="disc">
<li>
      <a class="ulink" href="http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html" target="_top">HOWTO recover deleted files on an ext3 file system</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/undelete-directories-files-on-ext3-filesystem-via-ext3grep/" target="_top">http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/</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/change-rpm-package-installation-directories/' rel='bookmark' title='Linux使用笔记: 更改RPM包的安装目录'>Linux使用笔记: 更改RPM包的安装目录</a></li>
<li><a href='http://easwy.com/blog/archives/mount-a-windows-shared-folder-on-linux-with-samba/' rel='bookmark' title='Linux使用笔记: 使用Samba访问windows的共享目录'>Linux使用笔记: 使用Samba访问windows的共享目录</a></li>
<li><a href='http://easwy.com/blog/archives/switch-to-single-user-mode-in-grub/' rel='bookmark' title='Linux使用笔记: Grub中进入单用户模式的方法'>Linux使用笔记: Grub中进入单用户模式的方法</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/undelete-directories-files-on-ext3-filesystem-via-ext3grep/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>在Debian Lenny上安装Apache Tomcat</title>
		<link>http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/</link>
		<comments>http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/#comments</comments>
		<pubDate>Fri, 01 May 2009 07:41:18 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=870</guid>
		<description><![CDATA[本文主要介绍如何在Debian Lenny上安装Apache Tomcat。 <a href="http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/">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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/' rel='bookmark' title='在debian etch中配置subversion版本管理'>在debian etch中配置subversion版本管理</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    以下主要参考了文章<a class="ulink" href="http://www.debianadmin.com/how-to-setup-apache-tomcat-55-on-debian-etch.html" target="_top">How to setup Apache Tomcat 5.5 on Debian Etch</a>。
  </p>
<p>
    首先，需要安装java JDK。可以直接到<a class="ulink" href="http://www.sun.com/" target="_top">sun的网站</a>上下载(现在应该叫Oracle了，最近这些天的事，Sigh!)，也可以在Debian仓库中下载。本文介绍由Debian仓库下载的方法。
  </p>
<p>
    打开<span class="emphasis"><em>/etc/apt/sources.list</em></span>文件，在此文件中加入下面的源：
  </p>
<pre class="programlisting">
# for sun-java packages in unstable
deb http://ftp.debian.org/debian/ unstable non-free
deb-src http://ftp.debian.org/debian/ unstable non-free </pre>
<p>
    保存并退出，然后用下面的命令更新一下源：
  </p>
<pre class="programlisting">

aptitude update </pre>
<p>
    然后就可以下载java JDK6了：
  </p>
<pre class="programlisting">
aptitude install sun-java6-jdk </pre>
<p>
    关于Apache web server的安装方法就不再描述了，可以参考文章<a class="ulink" href="http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/" target="_top">在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress…</a>。接下来我们安装tomcat：
  </p>
<pre class="programlisting">
aptitude install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps </pre>
<p>
    安装完后，在浏览器中输入<span class="bold"><strong>http://localhost:8180/</strong></span>，如果你能看到Apache Tomcat/5.5的页面，说明你的tomcat已经安装好了。我在输入上述地址时，有时会出现访问异常，不过刷新一下又可以访问了，还不清楚是什么原因。
  </p>
<p>
    接下来，我们需要一个用户，使之具有admin和manager权限，在本例中我们把admin和manager权限赋予用户tomcat。
  </p>
<p>    首先停用tomcat服务：
  </p>
<pre class="programlisting">
/etc/init.d/tomcat5.5 stop </pre>
<p>
    接下来编辑文件<span class="emphasis"><em> /var/lib/tomcat5.5/conf/tomcat-users.xml </em></span>，修改文件内容如下：
  </p>
<pre class="programlisting">

&lt;?xml version='1.0' encoding='utf-8'?&gt;
&lt;tomcat-users&gt;
  &lt;role rolename="admin"/&gt;
  &lt;role rolename="manager"/&gt;
  &lt;role rolename="tomcat"/&gt;
  &lt;user username="tomcat" password=”tomcatpassword” roles="tomcat,admin,manager"/&gt;

&lt;/tomcat-users&gt;
       </pre>
<p>
    保存退出后，重新启动tomcat服务：
  </p>
<pre class="programlisting">
/etc/init.d/tomcat5.5 start </pre>
<p>
    现在，就可以访问<span class="bold"><strong>http://localhost:8180/manager/html</strong></span>来管理tomcat了，用户名为tomcat，密码为tomcatpassword。
  </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/install-apache-tomcat-on-debian-lenny/" target="_top">http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/</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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/' rel='bookmark' title='在debian etch中配置subversion版本管理'>在debian etch中配置subversion版本管理</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/install-apache-tomcat-on-debian-lenny/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Linux中批量解压缩rar文件</title>
		<link>http://easwy.com/blog/archives/extract-multiple-rar-files-in-linux/</link>
		<comments>http://easwy.com/blog/archives/extract-multiple-rar-files-in-linux/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 09:32:47 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=827</guid>
		<description><![CDATA[本文介绍在Debian Linux下批量解压一批rar文件的技巧。 <a href="http://easwy.com/blog/archives/extract-multiple-rar-files-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/add_post_copyright_url/' rel='bookmark' title='在文章末尾添加版本声明和文章的链接'>在文章末尾添加版本声明和文章的链接</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>
<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>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>从windows中拷贝十几个rar文件到Debian，记得以前Linux下没有rar文件工具的，今天用apt-cache搜了一下，居然发现Debian Lenny中已经包含了一个名为rar的软件。以后接受别人的rar文件也不用担心解不开了。</p>
<p>要解压这么多文件也挺麻烦的，不过既然在Linux下，就有好办法，只需要在shell中输入下面一条命令(bash shell)：</p>
<pre class="programlisting">for f in `ls --color=none`; do rar x $f; done</pre>
<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/extract-multiple-rar-files-in-linux/" target="_top">http://easwy.com/blog/archives/extract-multiple-rar-files-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/add_post_copyright_url/' rel='bookmark' title='在文章末尾添加版本声明和文章的链接'>在文章末尾添加版本声明和文章的链接</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>
<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>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/extract-multiple-rar-files-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在Debian Lenny中配置Thinkpad T400的声卡</title>
		<link>http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/</link>
		<comments>http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 01:23:00 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=747</guid>
		<description><![CDATA[上一篇文章中我介绍了在Lenny中如何配置中文，这之后，Debian Linux环境基本满足我的需求了。直到有一天，需要在Linux中和一个朋友Skype通话，这时才发现我的声卡居然没有声音。
Thinkpad T400 AA1中所使用的是Intel内置的声卡，从lspci命令的输出中可以看到，此声卡已经被发现了... <a href="http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/">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_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<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/chinese_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置中文'>在Debian Lenny中配置中文</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    上一篇文章中我介绍了在Lenny中如何<a class="ulink" href="http://easwy.com/blog/archives/chinese_in_debian_lenny/" target="_top">配置中文</a>，这之后，Debian Linux环境基本满足我的需求了。直到前几天，需要在Linux中和一个朋友Skype通话，这时才发现我的声卡居然没有声音。
  </p>
<p>
    我在工作时不喜欢听着音乐，因为会干扰思路，所以，在准备skype之前我从未检查过声卡。现在发现声卡出现问题了，才想起要配置一下。
  </p>
<p>
    Thinkpad T400 AA1中所使用的是Intel内置的声卡，从<span class="command"><strong>lspci</strong></span>命令的输出中可以看到，此声卡已经被发现了：
  </p>
<pre class="screen">
# lspci | grep Audio
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
  </pre>
<p>
    再用<span class="command"><strong>lsmod</strong></span>查看一下声卡的驱动：
  </p>
<pre class="screen">
# lsmod | grep snd
snd_hda_intel         324248  4
snd_pcm_oss            32800  0
snd_mixer_oss          12320  1 snd_pcm_oss
snd_pcm                62596  3 snd_hda_intel,snd_pcm_oss
snd_seq_dummy           2660  0
snd_seq_oss            24992  0
snd_seq_midi            5728  0
snd_rawmidi            18496  1 snd_seq_midi
snd_seq_midi_event      6432  2 snd_seq_oss,snd_seq_midi
snd_seq                41456  6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_timer              17800  3 snd_pcm,snd_seq
snd_seq_device          6380  5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
snd                    45604  15 snd_hda_intel,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore               6368  1 snd
snd_page_alloc          7816  2 snd_hda_intel,snd_pcm
  </pre>
<p>
    我们看到，该声卡的驱动<span class="emphasis"><em>snd_hda_intel</em></span>也装好了，那为什么没有声音呢？
  </p>
<p>
    在网上搜索了一下，找到这篇文章：<a class="ulink" href="http://www.klabs.be/~fpiat/linux/debian/Lenny_on_Thinkpad_T61.html" target="_top">Debian Lenny on Thinkpad T61</a>，它提出了一个解决声卡没声音的方法，我按照这种方法操作了一下：
  </p>
<p>
    首先执行下面两条命令：
  </p>
<pre class="programlisting">
apt-get remove --purge  alsa-modules-$(uname -r)
invoke-rc.d alsa-utils restart </pre>
<p>
    然后打开音量控制(volume control)，转到Switch页，我这里选择了”IEC958 Default PCM”，然后转到播放页(Playback)，确定PCM没有被静音。作者说这样设置一下就可以了，不过我的计算机还不行。
  </p>
<p>
    对这种情况，作者也给出了解决方法，先关闭掉使用声卡的程序，然后用CTRL-ALT-F1切换到终端上，运行<span class="command"><strong>alsaconf</strong></span>，重新配置一下声卡。配好后，再按照上面的步骤配置一下音量控制。我使用<span class="command"><strong>alsaconf</strong></span>重新配置后，就可以听到声音了。
  </p>
<p>
    现在无论是开机登录的声音，播放MP3还是使用skype,都没有问题。不过在用KsCD听CD时，却无论如何也没有声音。
  </p>
<p>
    再次启用google，搜到了<a class="ulink" href="http://www.linuxforums.org/forum/debian-linux-help/75894-sound-problems-kde-3-5-5-a.html" target="_top">这个贴子</a>，按照帖子中的步骤：打开Extras &#8211;&gt; Configure KsCD &#8211;&gt; CD Player，勾上”Use direct digital playback”，然后在”Select audio backend”选择中”arts”，这样设置后，我的KsCD也可以正常工作了。
  </p>
<p>
    声卡好了以后，在使用rxvt时，如果出现错误，总是”滴滴”的响，很是麻烦。我在~/.bashrc中添加了<span class="command"><strong>xset b off</strong></span>，这样就不用听到恼人的声音了。另外，在/etc/inputrc文件中加上<span class="command"><strong>set bell-style none</strong></span>，关闭console下的声音。
  </p>
<p>
    在vim中的错误提示音早就在vimrc中关掉了，前几天刚好SamPeng问<a class="ulink" href="http://easwy.com/blog/about/#comment-209" target="_top">这个问题</a>，也在这篇文章回答一下。方法是在你的vimrc中，加入以下两行：
  </p>
<pre class="programlisting">
set noerrorbells
set visualbell t_vb= </pre>
<p>
    如果想关掉gvim中的”滴滴”提示音，则需要在gvimrc中加入<span class="command"><strong>set visualbell t_vb=</strong></span>，这是因为gvim在启动时，会把<span class="emphasis"><em>t_vb</em></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/thinkpad_t400_audio_in_debian_lenny/" target="_top">http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/</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_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<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/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/thinkpad_t400_audio_in_debian_lenny/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>升级Debian Etch(4.0)到Debian Lenny(5.0)</title>
		<link>http://easwy.com/blog/archives/upgrade_debian_etch_to_lenny/</link>
		<comments>http://easwy.com/blog/archives/upgrade_debian_etch_to_lenny/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 13:26:20 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=779</guid>
		<description><![CDATA[笔记本上安装了Debian Lenny后，用起来感觉很舒服，于是决定把台式机上的Etch也升级到Lenny。
对其它操作系统来说，也许升级不是件容易的事，但在Debian中，一切都很简单... <a href="http://easwy.com/blog/archives/upgrade_debian_etch_to_lenny/">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/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/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/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/debian-lenny-installation-on-thinkpad-t400/" target="_top">笔记本上安装了Debian Lenny</a>后，用起来感觉很舒服，于是决定把台式机上的Etch也升级到Lenny。
  </p>
<p>
    对其它操作系统来说，也许升级不是件容易的事，但在Debian中，一切都很简单。
  </p>
<p>
    升级之前要做的第一件事，是备份。虽然我升级没出一点问题，但谁能保证你也不出呢？所以先把你认为重要的资料备份一下。我主要是备份了/etc下的配置文件，至于/home，因为是单独分区，在升级时把它umount就可以了，用不着担心。
  </p>
<p>
    以下操作，都使用root用户进行操作，最好在终端下进行。
  </p>
<p>    备份完后，打开你的<span class="bold"><strong>/etc/apt/sources.list</strong></span>文件，把文件中所有的etch和stable，都替换成lenny。
  </p>
<p>
    然后执行命令更新一下软件包列表：
  </p>
<pre class="programlisting">
aptitude update </pre>
<p>
    在我这里出现了这样的提示：
  </p>
<pre class="screen">W: There is no public key available for the following key IDs: 4D270D06F42584E6</pre>
<p>
    用下面的命令下载并添加一下public key:
  </p>
<pre class="programlisting">

gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 4D270D06F42584E6
apt-key add ~/.gnupg/pubring.gpg </pre>
<p>
    然后再运行一次<span class="command"><strong>aptitude update</strong></span>命令，一切顺利。
  </p>
<p>
    接下来，先升级/安装apt及aptitude工具，因为etch版本的aptitude和apt工具被报告存在一些bug及不稳定因素，为了保证升级顺利，我们先升级一下这两个工具。我在文章<a class="ulink" href="http://easwy.com/blog/archives/chinese_in_debian_lenny/" target="_top">在Debian Lenny中配置中文</a>里面已经提到过，Debian现在推荐使用aptitude来安装软件，因为它能更智能的解决软件包间的依赖关系。
  </p>
<pre class="programlisting">
aptitude install apt aptitude </pre>
<p>
    这一步会安装libc6、locales以及libselinux等，会把诸如xdm、gdm、kdm这些服务重启，按提示做即可。
  </p>
<p>    接下来一步就是正式升级了，输入下面的命令：
  </p>
<pre class="programlisting">
aptitude full-upgrade </pre>
<p>
    也许会提示你有一些包推荐安装而未安装之类的，先不管它，一路yes。然后就是漫长的下载过程&#8230;
  </p>
<p>
    开始安装时，也许会需要你手动干预一下，按屏幕提示操作即可。在升级过程中一般会同时升级内核，可以用下面的命令看一下你的内核升级了没有：
  </p>
<pre class="programlisting">
dpkg -l "linux-image*" | grep ^ii </pre>
<p>
    如果没有看到任何输出，说明你的内核未升级，用aptitude选择一个内核升级一下。
  </p>
<p>
    接下来，就可以重启了，启动完成后，你就进入了Lenny的世界。Cheers!
  </p>
<p>    如果你英文还不错的话，建议读一下文尾的第一篇参考文档，这是Debian网站提供的升级指南。
  </p>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3682596"></a>参考文档</h2>
</div>
</div>
</div>
<div class="itemizedlist">
<ul type="disc">
<li><a class="ulink" href="http://www.debian.org/releases/lenny/i386/release-notes/ch-upgrading.en.html" target="_top">Upgrades from previous releases</a></li>
<li><a class="ulink" href="http://www.hughr.org/archives/2009/000691.html" target="_top">自Debian Etch向Debian Lenny升級</a></li>
</ul>
</div>
</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/upgrade_debian_etch_to_lenny/" target="_top">http://easwy.com/blog/archives/upgrade_debian_etch_to_lenny/</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/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/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/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/upgrade_debian_etch_to_lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Debian Lenny上安装Apache2，PHP5，MySQL5, WordPress&#8230;</title>
		<link>http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/</link>
		<comments>http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 05:40:38 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=772</guid>
		<description><![CDATA[ 这几天访问Easwy的博客非常慢，在上面调试程序变成了痛苦的折磨。于是干脆在自己的笔记本上安装一个Web服务器来调试吧。
我笔记本上安装了Debian Lenny，使用Debian确实是省心又省力，基本你只需要会用aptitude install就可以了，其它的事情，Debian全帮你做好了。在Debian上安装Apache Web服务器以及PHP5和MySQL非常简单，只需要按照下面的步骤... <a href="http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/">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-tomcat-on-debian-lenny/' rel='bookmark' title='在Debian Lenny上安装Apache Tomcat'>在Debian Lenny上安装Apache Tomcat</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/' rel='bookmark' title='在debian etch中配置subversion版本管理'>在debian etch中配置subversion版本管理</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    这几天<a class="ulink" href="http://easwy.com/blog/archives/please_tell_me_your_access_speed/" target="_top">访问Easwy的博客非常慢</a>，在上面调试程序变成了痛苦的折磨。于是干脆在自己的笔记本上安装一个Web服务器来调试吧。
  </p>
<p>
    我笔记本上<a class="ulink" href="http://easwy.com/blog/archives/debian-lenny-installation-on-thinkpad-t400/" target="_top">安装了Debian Lenny</a>，使用Debian确实是省心又省力，基本你只需要会用<span class="command"><strong>aptitude install</strong></span>就可以了，其它的事情，Debian全帮你做好了。在Debian上安装Apache Web服务器以及PHP5和MySQL非常简单，只需要按照下面的步骤：
  </p>
<p>安装Apache2:</p>
<pre class="programlisting">
aptitude install apache2 </pre>
<p>
    这件命令安装apache服务器，安装完成后，Apache服务器的配置文件在<span class="bold"><strong>/etc/apache2/</strong></span>，缺省的web服务器根目录在<span class="bold"><strong>/var/www/</strong></span>，安装完后，你在浏览器的地址栏输入<span class="emphasis"><em>http://localhost/</em></span>，如果可以看到<span class="bold"><strong>It works!</strong></span>这样的内容，那么你的web服务器已经运行起来了。
  </p>
<p>
    接下来安装PHP5和MySQL5、Curl(HTTP工具)、IMAP(邮件检查)、GD (编辑和创建图像)：
  </p>
<pre class="programlisting">
aptitude install libapache2-mod-php5 php5-curl php5-gd php5-imap php5-mcrypt php5-mysql php5-tidy </pre>
<p>
    接下来安装MySQL5服务器和客户端：
  </p>
<pre class="programlisting">
aptitude install mysql-server mysql-client </pre>
<p>
    MySQL的配置文件在<span class="bold"><strong>/etc/mysql/my.cnf</strong></span>，在安装MySQL服务器的时候，会要求你输入root密码。
  </p>
<p>
    最后，安装PHPMyAdmin工具：
  </p>
<pre class="programlisting">
aptitude install phpmyadmin </pre>
<p>
    PHPMyAdmin会自动配置Apache服务器，安装完后，可以直接输入<span class="bold"><strong>http://localhost/phpmyadmin/</strong></span>来访问PHPMyAdMin。
  </p>
<p>
    我们可以查看一下PHP的信息，以确信PHP已经运行起来了：
  </p>
<p>
    使用编辑器输入以下内容，把它保存成<span class="bold"><strong>/var/www/phpinfo.php</strong></span>：
  </p>
<pre class="programlisting">
&lt;?php phpinfo(); ?&gt; </pre>
<p>
    然后在浏览器地址栏输入<span class="bold"><strong>http://localhost/phpinfo.php</strong></span>，你就可以看到PHP有关的配置信息。
  </p>
<p>
    接下来安装WordPress程序，安装步骤网上很多，不再详述。
  </p>
<p>
    出于安全起见，不打算使用MySQL中的root用户来访问PHP的数据库，所以使用PHPMyAdmin(访问方法见上)专门添加了一个数据库用户wordpress，并创建一个名为wordpressdb的数据库，给予wordpress用户对wordpressdb数据库的完全控制权。
  </p>
<p>
    创建完数据库后，把WordPress拷贝到/var/www/wordpress/目录下，修改配置文件wp-config.php，主要是配置数据库信息，然后到下面的地址完成安装：
  </p>
<pre class="programlisting">
http://localhost/wordpress/wp-admin/install.php </pre>
<p>
    现在，去访问你自己的WordPress吧。Everything is OK!
  </p>
<p>
    需要说明一下：
  </p>
<p>
    Debian Lenny中的缺省web server缺省使用www-data用户运行，所以，最好使用<span class="command"><strong>chown -R www-data.www-data /var/www/wordpress</strong></span>命令把WordPress目录的属主改为www-data。有些程序要求对目录有读写权限，其实就是希望www-data用户对目录有读写权限。
  </p>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3843594"></a>参考文档</h2>
</div>
</div>
</div>
<div class="itemizedlist">
<ul type="disc">
<li><a class="ulink" href="http://www.arkinex.com/guides/25/installing-apache2-mysql5-and-php5-on-debian-linux/" target="_top">Installing Apache2, Mysql5 and PHP5 on Debian Linux</a></li>
</ul>
</div>
</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_php_mysql_wordpress_on_debian_lenny/" target="_top">http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/</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-tomcat-on-debian-lenny/' rel='bookmark' title='在Debian Lenny上安装Apache Tomcat'>在Debian Lenny上安装Apache Tomcat</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/' rel='bookmark' title='在debian etch中配置subversion版本管理'>在debian etch中配置subversion版本管理</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/install_apache_php_mysql_wordpress_on_debian_lenny/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在Debian Lenny中配置中文</title>
		<link>http://easwy.com/blog/archives/chinese_in_debian_lenny/</link>
		<comments>http://easwy.com/blog/archives/chinese_in_debian_lenny/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 02:04:10 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=741</guid>
		<description><![CDATA[红点驱动装好以后，就开始对中文进行配置。我配置中文按照如下步骤：
- 产生语系 (locale)
- 配置中文字体
- 配置中文输入法
- 安装Windows字体(可选) <a href="http://easwy.com/blog/archives/chinese_in_debian_lenny/">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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/vim_command_parameter_separator/' rel='bookmark' title='关于vi/vim中:s命令的参数分隔符'>关于vi/vim中:s命令的参数分隔符</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    <a class="ulink" href="http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/" target="_top">Thinkpad的红点驱动</a>装好以后，就开始对中文进行配置。我配置中文按照如下步骤。
  </p>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3845224"></a>产生语系 (locale) </h2>
</div>
</div>
</div>
<p>
      使用英文界面安装完后，系统所使用的locale是en_US.utf8，我们需要生成中文的locale。
    </p>
<p>
      如果没有安装locales，首先需要安装locales程序，Debian现在推荐使用aptitude来安装程序，它能比apt-get更好的解决软件包之间的冲突。
    </p>
<pre class="programlisting">
# aptitude install locales </pre>
<p>
      安装完locales后，就重新选择Debian所使用的语系，命令是：
    </p>
<pre class="programlisting">
# dpkg-reconfigure locales </pre>
<p>
      我选择了下面的locale：
    </p>
<div class="itemizedlist">
<ul type="disc">
<li>en_US.ISO-8859-1</li>
<li>en_US.UTF-8</li>
<li>zh_CN.GB2312</li>
<li>zh_CN.GB18030</li>
<li>zh_CN.UTF-8</li>
<li>zh_CN.GBK</li>
<li>zh_TW.BIG5</li>
<li>zh_TW.UTF-8</li>
</ul>
</div>
<p>      不过我的缺省locale依旧设置为en_US.utf8，因为我更习惯于使用英文界面。在Linux中，即使使用英文locale，也能够很好的支持中文。
    </p>
<p>
      使用<span class="command"><strong>locale -a</strong></span>命令查看一下Lenny中的语系，在我的计算机上输出如下：
    </p>
<pre class="screen">
      # locale -a
      C
      en_US
      en_US.iso88591
      en_US.utf8
      POSIX
      zh_CN
      zh_CN.gb18030
      zh_CN.gb2312
      zh_CN.gbk
      zh_CN.utf8
      zh_TW
      zh_TW.big5
      zh_TW.utf8
    </pre>
<p>
      配置好语系(locale)后，最好重新登录一次。
    </p>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3845294"></a>配置中文字体</h2>
</div>
</div>
</div>
<p>
      接下来需要安装一下中文字体。在系统安装时，我已经选择了简体中文桌面(Simplified Chinese Desktop)和简体中文环境(Simplified Chinese Environment)，这里面就包含了一些中文字体和中文应用程序，比如中文输入法。
    </p>
<p>      在我的系统里安装了下面这些中英文字体包，主要参考了<a class="ulink" href="http://edyfox.codecarver.org/html/debian_testing_chinese.html" target="_top">滇狐</a>的字体配置：
    </p>
<div class="itemizedlist">
<ul type="disc">
<li>
        ttf-arphic-ukai
      </li>
<li>
        ttf-arphic-uming
      </li>
<li>
        xfonts-wqy
      </li>
<li>
        ttf-bitstream-vera
      </li>
<li>
        ttf-mscorefonts-installer
      </li>
</ul>
</div>
<p>
      上面的mscorefonts是Sourceforge上的一个项目，这是微软提供的Windows上的核心字体，允许用户下载使用。Debian Lenny提供了ttf-mscorefonts-installer这样一个包，这个包在安装时会自动到Sourceforge上下载mscorefont。因为很多Windows程序在mscorefont下显示比较美观，所以我们也安装这一字体。
    </p>
<p>
      安装了上述字体以后，再把滇狐提供的.font.conf(在上面滇狐的网页中下载)放在自己的HOME目录下。退出重新登录进来，Lenny的字体已经非常漂亮了!
    </p>
<p>
      下面贴两张图，一张是Debian Lenny刚刚安装完简体中文桌面和简体中文环境，未进行字体前的抓图，另外一张则是按上面的步骤进行了字体配置后的抓图，做一个比较。
    </p>
<div class="informalfigure">
<div class="mediaobject" align="center"><img src="http://easwy.com/blog/uploads/2009/04/iceweasel_before_cn_font-300x176.png" align="middle"></div>
<div class="caption" align="center"><a class="ulink" href="http://easwy.com/blog/uploads/2009/04/iceweasel_before_cn_font.png" target="_top">点击查看大图</a></div>
</div>
<div class="informalfigure">
<div class="mediaobject" align="center"><img src="http://easwy.com/blog/uploads/2009/04/iceweasel_after_font-300x187.png" align="middle"></div>
<div class="caption" align="center"><a class="ulink" href="http://easwy.com/blog/uploads/2009/04/iceweasel_after_font.png" target="_top">点击查看大图</a></div>
</div>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3845679"></a>配置中文输入法</h2>
</div>
</div>
</div>
<p>
      Linux下中文输入法目前最常用的有两种，一个是scim，另外一个是fcitx。我更习惯于使用fcitx，所以这里以fcitx为例进行介绍。
    </p>
<p>      在安装简体中文桌面时，其实已经安装了fcitx输入法，接下来配置一下就可以了。从理论上讲，使用im-switch应该可以很方便的在各个中文输入法间进行切换，可是我尝试了几次，即使使用<span class="command"><strong>im-switch -c</strong></span>把输入法切换到fcitx，还是不能启动fcitx，不知道是不是和我把LANG环境变量设置成en_US.UTF-8有关。没办法，还是按照网上流传的方法，编辑一个名为95xinput的文件，内容如下：
    </p>
<pre class="programlisting">
# easwy, 2009/03/15
export LANG="en_US.UTF-8"
export LC_CTYPE="zh_CN.UTF-8"
export XMODIFIERS="@im=fcitx"
fcitx &amp; </pre>
<p>
    在这个文件里，我把我的LANG设置为en_US.UTF-8，但把LC_CTYPE设置成zh_CN.UTF-8，这样在英文环境中也可以输入中文。接下来就是设置输入法，并启动fcitx。
  </p>
<p>
    把这个文件放到/etc/X11/Xsession.d/目录即可，在X启动时/etcX11/Xsession脚本会自动执行此文件，启动fcitx输入法。
  </p>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3845720"></a>安装Windows字体(可选)</h2>
</div>
</div>
</div>
<p>
      如果想在Linux里使用windows的字体,可以以root身份按如下步骤操作:
    </p>
<pre class="programlisting">

mount -t ntfs /dev/sda1 /mnt
mkdir -p /usr/local/share/fonts/msfonts
cp /mnt/WINDOWS/Fonts/sim* /usr/local/share/fonts/msfonts/
chmod a+r /usr/local/share/fonts/msfonts/*
fc-cache /usr/local/share/fonts/msfonts/ </pre>
<p>
    上面的/dev/sda1是我的windows分区，你可以用<span class="command"><strong>fdisk -l</strong></span>查看一下你的windows分区是哪一个。因为windows分区一般都使用NTFS格式，所以在mount时要加上<span class="emphasis"><em>-t ntfs</em></span>。上面的命令只拷贝了和简体中文相关的字体，我觉得Debian Linux下的英文已经比较好看了。
  </p>
<p>
    安装完后，用<span class="command"><strong>fc-list | grep -i sun</strong></span>查看一下，是不是宋体已经安装成功，在我的计算机上输出如下：
  </p>
<pre class="screen">
新宋体,NSimSun:style=Regular
宋体\-PUA,SimSun\-PUA:style=Regular
宋体,SimSun:style=Regular
文鼎ＰＬ简报宋,AR PL SungtiL GB:style=Regular
  </pre>
<p>
    在滇狐的.font.conf中已经加入了对宋体和新宋体的支持，所以不需再进行配置就可以使用。
  </p>
<p>    我在安装完windows字体后，在启动firefox时会出现下面的错误提示：
  </p>
<pre class="programlisting">
......
(firefox-bin:4411): Pango-WARNING **: failed to create cairo scaled font, expect ugly output. the offending font is 'SimSun Bold 18'
(firefox-bin:4411): Pango-WARNING **: failed to create cairo scaled font, expect ugly output. the offending font is '宋体 Bold 10.771484375'
(firefox-bin:4411): Pango-WARNING **: failed to create cairo scaled font, expect ugly output. the offending font is '宋体 Bold 12'
(firefox-bin:4411): Pango-WARNING **: shaping failure, expect ugly output. shape-engine='BasicEngineFc', font='宋体 Bold 12', text='Chinese ('
(firefox-bin:4411): Pango-WARNING **: shaping failure, expect ugly output. shape-engine='BasicEngineFc', font='宋体 Bold 10.771484375', text=' '
......  </pre>
<p>
    这是由于字体文件的权限不正确，后来用<span class="command"><strong>chmod a+r /usr/local/share/fonts/msfonts/*</strong></span>为所有用户增加读权限后，就正常了。
  </p>
<p>
    如果你还是出现上面的错误，可以试着执行一遍以下几条命令：
  </p>
<pre class="programlisting">
dpkg-reconfigure libcairo2 libpango1.0-common
fc-cache -fs
update-pangox-aliases </pre>
</div>
<div class="section" lang="zh-CN">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a name="id3845776"></a>参考文档</h2>
</div>
</div>
</div>
<div class="itemizedlist">
<ul type="disc">
<li><a class="ulink" href="http://www.debsir.org/main/?q=node/85" target="_top">Debian中文桌面的快速构建</a></li>
<li><a class="ulink" href="http://211.100.7.181/~liling/debian-pretty.html" target="_top">Linux/美化及中文化</a>，原文似乎已经打不开，可以看<a class="ulink" href="http://zu.meltonfoundation.org/home/xg_liu2/public_html/wiki/index.php?title=Linux/%E7%BE%8E%E5%8C%96%E5%8F%8A%E4%B8%AD%E6%96%87%E5%8C%96" target="_top">这里的转载</a></li>
<li><a class="ulink" href="http://edyfox.codecarver.org/html/debian_testing_chinese.html" target="_top">简单搞定debian下的字体</a>,原文经常不可访问,可以看<a class="ulink" href="http://blog.chinaunix.net/u1/51156/showart_407719.html" target="_top">这里的转载</a></li>
<li><a class="ulink" href="http://www.fcitx.org/main/?q=node/37" target="_top">fcitx配置文件</a></li>
</ul>
</div>
</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/chinese_in_debian_lenny/" target="_top">http://easwy.com/blog/archives/chinese_in_debian_lenny/</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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</a></li>
<li><a href='http://easwy.com/blog/archives/vim_command_parameter_separator/' rel='bookmark' title='关于vi/vim中:s命令的参数分隔符'>关于vi/vim中:s命令的参数分隔符</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/chinese_in_debian_lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Linux中使用thinkpad的小红点+中键</title>
		<link>http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/</link>
		<comments>http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 14:40:31 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=732</guid>
		<description><![CDATA[ 安装完无线驱动以后，就琢磨怎么在Debian Lenny中把Thinkpad的小红点用起来。
Thinkpad的小红点应该说是小黑的的特色之一了，用的熟了工作效率不比用鼠标差。用其它的本本我通常是用触摸板，感觉不是很方便，尤其是在上下滚屏时，要用两只手配合。而小黑的小红点+中键，只用一只手就能方便的上下左右滚屏，非常方便。  <a href="http://easwy.com/blog/archives/thinkpad_trackpoint_on_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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</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>
<li><a href='http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/' rel='bookmark' title='在CentOS 5上安装Ubuntu KVM虚拟机'>在CentOS 5上安装Ubuntu KVM虚拟机</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    <a class="ulink" href="http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/" target="_top">安装完无线驱动</a>以后，就琢磨怎么在Debian Lenny中把Thinkpad的小红点用起来。
  </p>
<p>
    Thinkpad的小红点应该说是小黑的的特色之一了，用的熟了工作效率不比用鼠标差。用其它的本本我通常是用触摸板，感觉不是很方便，尤其是在上下滚屏时，要用两只手配合。而小黑的小红点+中键，只用一只手就能方便的上下左右滚屏，非常方便。
  </p>
<p>
    从设计来看，黑色键盘中间一个红色的小点，最是吸引人的目光。记得我的小黑刚搬回来的时候，我女儿就盯上了这个红色的小点，一直想用手指去摸去抠，被我制止了。我装完系统就关机出去了，第二天回家打开小黑一看，怎么小红点没了？一想，肯定是小家伙干的！最后，在垃圾桶里找回了心爱的小红点。看来是小家伙不小心把它抠了下来，又不会装回去，就扔到垃圾桶去了。后来我就教她怎么用这个小红点控制光标的方向，这以后，她就没再干过抠红点的事。这算是和小红点有关的一件趣事吧。
  </p>
<p>
    小红点的中键按下时，再控制红点的方向时，就能够实现八个方向的滚屏。下图是我在<a class="ulink" href="http://blog.10ninox.com/2007/12/10/whats-so-good-about-trackpoint/" target="_top">这个网站</a>看到的，很形象的表示了中键的用法(感谢这副图的作者)。
  </p>
<div class="informalfigure">
<div class="mediaobject" align="center"><img src="http://easwy.com/blog/uploads/2009/04/thinkpad_trackpoint.gif" align="middle"></div>
</div>
<p>    在windows里，联想OEM的windows已经自动支持小红点的中键了。，但在Linux里还需要配置一下。
  </p>
<p>
    我们先执行命令<span class="command"><strong>dmidecode -t 21</strong></span>，这个命令会输出小黑内置的鼠标设备的信息，我们看到输出如下：
  </p>
<pre class="screen">
# dmidecode 2.9
SMBIOS 2.4 present.

Handle 0x0032, DMI type 21, 7 bytes
Built-in Pointing Device
	Type: Track Point
	Interface: PS/2
	Buttons: 3

Handle 0x0033, DMI type 21, 7 bytes
Built-in Pointing Device
	Type: Touch Pad
	Interface: PS/2
	Buttons: 0
  </pre>
<p>
    Linux已经自动识别出两个内置鼠标设备：Track Point (小红点)和Touch Pad (触摸板)。实际上小红点和触摸板都已经可以使用，只是小红点的中键在Linux缺省未打开，需要改一下配置。
  </p>
<p>
    配置很简单，把文章<a class="ulink" href="http://wiki.debian.org/InstallingDebianOn/Thinkpad/Trackpoint" target="_top">Trackpoint on Lenny</a>里的这段话加到你的xorg.conf中就可以了。打开/etc/X11/xorg.conf，在此文件中找到”Configured Mouse”这一节，然后加下下面三行：
  </p>
<pre class="programlisting">

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"

        # 加入下面三行
        Option          "EmulateWheel"          "true"
        Option          "EmulateWheelTimeOut"   "200"
        Option          "EmulateWheelButton"    "2"
EndSection </pre>
<p>
    重新登录X window，再试试小红点+中键，是不是好用了？
  </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/thinkpad_trackpoint_on_linux/" target="_top">http://easwy.com/blog/archives/thinkpad_trackpoint_on_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/thinkpad_t400_wireless_driver_for_debian_lenny/' rel='bookmark' title='在debian lenny上安装thinkpad t400无线驱动'>在debian lenny上安装thinkpad t400无线驱动</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>
<li><a href='http://easwy.com/blog/archives/centos-kvm-virtulization-ubuntu-guest/' rel='bookmark' title='在CentOS 5上安装Ubuntu KVM虚拟机'>在CentOS 5上安装Ubuntu KVM虚拟机</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/thinkpad_trackpoint_on_linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在debian lenny上安装thinkpad t400无线驱动</title>
		<link>http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/</link>
		<comments>http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 15:27:44 +0000</pubDate>
		<dc:creator>Easwy</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[thinkpad]]></category>

		<guid isPermaLink="false">http://easwy.com/blog/?p=724</guid>
		<description><![CDATA[登录lenny后，使用/sbin/ifconfig看到已经存在一个名为wlan0的无线网卡。既然无线网卡已经发现，驱动也已经装好，那么只需要配置一下应该就可以用了。于是打开文件/etc/network/interface，在这个文件里增加了无线网卡的配置... <a href="http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/">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/chinese_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置中文'>在Debian Lenny中配置中文</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置Thinkpad T400的声卡'>在Debian Lenny中配置Thinkpad T400的声卡</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/' rel='bookmark' title='在debian etch中配置subversion版本管理'>在debian etch中配置subversion版本管理</a></li>
</div><div class="fixed"></div>]]></description>
			<content:encoded><![CDATA[<p>
    <a href="http://easwy.com/blog/archives/debian-lenny-installation-on-thinkpad-t400/">安装完debian lenny</a>后，常用的设备驱动都已经安装好，做一些日常应用已经没什么问题。接下来，我就开始配置无线网卡的驱动。
  </p>
<p>
    首先说一下我所用的无线路由器的配置。我的无线路由器是Linksys的WRT54G V4.0，无线网络名设置为easwy，使用WPA2 Person加密认证，出于安全的考虑，不广播SSID，并且只允许特定的MAC地址无线接入。
  </p>
<p>
    登录lenny后，使用<span class="command"><strong>/sbin/ifconfig</strong></span>看到已经存在一个名为wlan0的无线网卡，心中一阵暗喜，暗道Linux进步果然神速，对硬件的支持已经做的这么好。没想到正是这一时的大意，让我费了诸多周折。
  </p>
<p>
    既然无线网卡已经发现，驱动也已经装好，那么只需要配置一下应该就可以用了。于是打开文件<span class="emphasis"><em>/etc/network/interface</em></span>，在这个文件里增加了无线网卡的配置：
  </p>
<pre class="programlisting">

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

# The wireless interface
auto wlan0
iface wlan0 inet dhcp
	wpa-ssid "easwy"
	wpa-psk "xxxxxxxx"
	wpa-ap-scan 1
	wpa-scan-ssid 1 </pre>
<p>
    简单解释一下wlan0的配置：
  </p>
<div class="itemizedlist">
<ul type="disc">
<li><span class="command"><strong>auto wlan0</strong></span>的意思是wlan0接口在系统启动时自动启动。
    </li>
<li><span class="command"><strong>iface wlan0 inet dhcp</strong></span>的意思是这个接口使用DHCP来获取IP地址
    </li>
<li><span class="command"><strong>wpa-ssid</strong></span>用来配置无线网络的SSID
    </li>
<li><span class="command"><strong>wpa-psk</strong></span>配置连接easwy无线网络的密码
    </li>
<li><span class="command"><strong>wpa-ap-scan 1</strong></span>和<span class="command"><strong>wpa-scan-ssid 1</strong></span>主要用来扫描不广播SSID的无线接入点。因为我的无线路由器不广播SSID，所以加了这两条配置。
    </li>
</ul>
</div>
<p>    这样配置好后，使用<span class="command"><strong>/sbin/ifdown wlan0</strong></span>关闭wlan0网卡，然后再重新启用<span class="command"><strong>/sbin/ifup wlan0</strong></span>，发现无法获得IP地址，输出如下：
  </p>
<pre class="screen">
    run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
    Internet Systems Consortium DHCP Client V3.1.1
    Copyright 2004-2008 Internet Systems Consortium.
    All rights reserved.
    For info, please visit http://www.isc.org/sw/dhcp/

    wmaster0: unknown hardware address type 801
    wmaster0: unknown hardware address type 801
    Listening on LPF/wlan0/00:22:69:68:8b:86
    Sending on   LPF/wlan0/00:22:69:68:8b:86
    Sending on   Socket/fallback
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
    DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 17
    No DHCPOFFERS received.
    No working leases in persistent database - sleeping.
    --- in /var/wpa_supplicant.wlan0.log
    1235814861.502506: Cancelling authentication timeout
    1235814861.502518: WEXT: Operstate: linkmode=0, operstate=6
  </pre>
<p>
    这时我还没怀疑到驱动的问题，还以为是自己配置的问题，于是开始进行各种检查。
  </p>
<p>
    首先查看一下T400 AA1所用的无线网卡芯片：
  </p>
<pre class="screen">
    # lspci -nn | grep Ethernet
    00:19.0 Ethernet controller [0200]: Intel Corporation 82567LM Gigabit Network Connection [8086:10f5] (rev 03)
    03:00.0 Ethernet controller [0200]: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter [168c:001c] (rev 01)
  </pre>
<p>    从这里可以看出，我的无线网卡使用的是Atheros的AR242x系列芯片(具体型号是AR2425)。使用<span class="command"><strong>lsmod</strong></span>命令查看了一下网卡所使用的驱动是ath5k。在网上搜索了一下，似乎ath5k驱动可以驱动这个芯片，接下来又用<span class="command"><strong>/sbin/iwconfig</strong></span>查看了无线网卡的配置，似乎也没什么问题。
  </p>
<p>
    这样折腾了很久之后，开始怀疑是不是网卡驱动有问题？在debian wiki上搜索了一下，发现MadWifi是用的比较多的Atheros芯片驱动，抱着试试看的态度，尝试安装MadWifi驱动。
  </p>
<p>
    按照文章<a class="ulink" href="http://wiki.debian.org/WiFi/ath_pci" target="_top">Atheros AR5xxx devices (MadWifi)</a>的步骤，首先将下面的源加入到<span class="emphasis"><em>/etc/apt/sources.list</em></span>文件中：
  </p>
<pre class="programlisting">

# Debian Lenny/5.0
deb http://ftp.us.debian.org/debian lenny main contrib non-free </pre>
<p>
    接下来更新源中的安装包列表，并且下载module-assistant和wireless-tools安装包：
  </p>
<pre class="programlisting">
aptitude update
aptitude install module-assistant wireless-tools </pre>
<p>
    编译安装madwifi-modules-*包：
  </p>
<pre class="programlisting">
m-a prepare
m-a a-i madwifi </pre>
<p>
    卸载athtk内核模块，然后加载atp_pci内核模块：
  </p>
<pre class="programlisting">
modprobe -r ath5k
modprobe ath_pci </pre>
<p>    这样配置之后，再用<span class="command"><strong>/sbin/iwconfig</strong></span>命令查看一下无线网卡的状态，正常。
  </p>
<p>
    修改<span class="emphasis"><em>/etc/network/interface</em></span>文件，把上面文件中的wlan0改为ath0，因为MadWifi驱动使用的网卡名称是ath0。这样修改后，使用<span class="command"><strong>/sbin/ifup ath0</strong></span>，哈哈，无线网卡可以正常工作了！
  </p>
<p>
    奉上<span class="command"><strong>/sbin/iwconfig</strong></span>命令和<span class="command"><strong>/sbin/ifup ath0</strong></span>命令的输出，以供参考：
  </p>
<pre class="screen">

    # /sbin/iwconfig ath0
    ath0      IEEE 802.11g  ESSID:"easwy"  Nickname:""
              Mode:Managed  Frequency:2.437 GHz  Access Point: Not-Associated
              Bit Rate:1 Mb/s   Tx-Power:16 dBm   Sensitivity=1/1
              Retry:off   RTS thr:off   Fragment thr:off
              Power Management:off
              Link Quality=0/70  Signal level=-96 dBm  Noise level=-96 dBm
              Rx invalid nwid:171945  Rx invalid crypt:0  Rx invalid frag:0
              Tx excessive retries:0  Invalid misc:0   Missed beacon:0
    # /sbin/ifup ath0
    Internet Systems Consortium DHCP Client V3.1.1
    Copyright 2004-2008 Internet Systems Consortium.
    All rights reserved.
    For info, please visit http://www.isc.org/sw/dhcp/

    wifi0: unknown hardware address type 801
    wifi0: unknown hardware address type 801
    Listening on LPF/ath0/00:22:69:68:8b:86
    Sending on   LPF/ath0/00:22:69:68:8b:86
    Sending on   Socket/fallback
    DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 4
    DHCPOFFER from 192.168.1.1
    DHCPREQUEST on ath0 to 255.255.255.255 port 67
    DHCPACK from 192.168.1.1
    bound to 192.168.1.100 -- renewal in 37824 seconds.
  </pre>
<div class="section" lang="zh-CN">
<div class="titlepage"></div>
<p>参考文档</p></div>
<div class="itemizedlist">
<ul type="disc">
<li><a class="ulink" href="http://wiki.debian.org/WiFi/ath_pci" target="_top">Atheros AR5xxx devices (MadWifi)</a></li>
<li><a class="ulink" href="http://wiki.debian.org/WiFi/HowToUse" target="_top">How to use a WiFi interface</a></li>
<li>
      /usr/share/doc/wpasupplicant/README.gz
    </li>
<li>
      /usr/share/doc/wpasupplicant/README.modes.gz
    </li>
<li>
      /usr/share/doc/wpasupplicant/README.wpa_supplicant.conf.gz
    </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/thinkpad_t400_wireless_driver_for_debian_lenny/" target="_top">http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/</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/chinese_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置中文'>在Debian Lenny中配置中文</a></li>
<li><a href='http://easwy.com/blog/archives/thinkpad_t400_audio_in_debian_lenny/' rel='bookmark' title='在Debian Lenny中配置Thinkpad T400的声卡'>在Debian Lenny中配置Thinkpad T400的声卡</a></li>
<li><a href='http://easwy.com/blog/archives/subversion-configuration-in-debian-etch/' rel='bookmark' title='在debian etch中配置subversion版本管理'>在debian etch中配置subversion版本管理</a></li>
</div><div class="fixed"></div>]]></content:encoded>
			<wfw:commentRss>http://easwy.com/blog/archives/thinkpad_t400_wireless_driver_for_debian_lenny/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

