<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[刘佳的技术日志、博客]]></title> 
<link>http://www.52zhe.cn/index.php</link> 
<description><![CDATA[技术的事，喜欢就研究。]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[刘佳的技术日志、博客]]></copyright>
<item>
<link>http://www.52zhe.cn/read.php/.htm</link>
<title><![CDATA[从误删除/etc/apache2目录谈rpm与dpkg的包对比管理。]]></title> 
<author>kook &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Ubuntu]]></category>
<pubDate>Wed, 31 Oct 2007 08:04:57 +0000</pubDate> 
<guid>http://www.52zhe.cn/read.php/.htm</guid> 
<description>
<![CDATA[ 
	从误删除/etc/apache2目录谈rpm与dpkg的包对比管理。<br/><br/>那天一个同事由于不爽配置文件出错。一怒之下将ubnut 7.04下/etc/apache2目录删除了。我当时好奇做过去研究了一下。发现/etc/apache2目录下多半是由apache2-common这个包产生的。于是想到了覆盖安装。心想，这个还不简单。在rpm使用下，可以一个--froce搞定。先不说如何解决的。先来复习一下rpm的常用查询命令。并且做了个列表用来对比。<br/><div class="code"><br/>1:查询某个文件属于哪个软件包<br/>-------------------------------------------------------------------------------------<br/>&#91;root@server ~&#93;# rpm -qf /etc/httpd/conf/httpd.conf<br/>httpd-2.2.3-6.el5<br/>-------------------------------------------------------------------------------------<br/>root@fixip:/etc/apache2# dpkg -S /etc/apache2/apache2.conf<br/>apache2.2-common: /etc/apache2/apache2.conf<br/>-------------------------------------------------------------------------------------<br/>2:查询某个包产生的文件列表<br/>-------------------------------------------------------------------------------------<br/>&#91;root@server Server&#93;# rpm -ql tree &nbsp;（未安装的包可以用p参数：-qpl 完整包名）<br/>/usr/bin/tree<br/>/usr/share/doc/tree-1.5.0<br/>/usr/share/doc/tree-1.5.0/README<br/>/usr/share/man/man1/tree.1.gz<br/>-------------------------------------------------------------------------------------<br/>root@fixip:/var/cache/apt/archives# dpkg -L tree （可以用-c 必须用完整包名）<br/>/.<br/>/usr<br/>/usr/bin<br/>/usr/bin/tree<br/>/usr/share<br/>/usr/share/man<br/>/usr/share/man/man1<br/>/usr/share/man/man1/tree.1.gz<br/>/usr/share/doc<br/>/usr/share/doc/tree<br/>/usr/share/doc/tree/README<br/>/usr/share/doc/tree/copyright<br/>/usr/share/doc/tree/changelog.gz<br/>/usr/share/doc/tree/changelog.Debian.gz<br/>-------------------------------------------------------------------------------------<br/>3:查询已所有的安装包<br/>&#91;root@server Server&#93;# rpm -qa<br/>-------------------------------------------------------------------------------------<br/>root@fixip:/var/cache/apt/archives# dpkg -l<br/>.......<br/><br/>ii &nbsp;time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1.7-21build1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The GNU time program for measuring cpu resource usage<br/>ii &nbsp;tzdata &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2007f-3ubuntu1 &nbsp; &nbsp; &nbsp; &nbsp; time zone and daylight-saving time data<br/>ii &nbsp;ubuntu-keyring &nbsp; &nbsp; &nbsp; &nbsp; 2007.06.11 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GnuPG keys of the Ubuntu archive<br/>ii &nbsp;ubuntu-minimal &nbsp; &nbsp; &nbsp; &nbsp; 1.79 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Minimal core of Ubuntu<br/>ii &nbsp;ubuntu-standard &nbsp; &nbsp; &nbsp; &nbsp;1.79 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; The Ubuntu standard system<br/>ii &nbsp;ucf &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.001 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Update Configuration File: preserves user changes to config<br/>.......<br/>-------------------------------------------------------------------------------------<br/>4:查询安装包的信息<br/>-------------------------------------------------------------------------------------<br/>&#91;root@server Server&#93;# rpm -qi tree<br/>Name &nbsp; &nbsp; &nbsp; &nbsp;: tree &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Relocations: /usr<br/>Version &nbsp; &nbsp; : 1.5.0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Vendor: Red Hat, Inc.<br/>Release &nbsp; &nbsp; : 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Build Date: Sat 15 Jul 2006 11:08:46 AM CST<br/>Install Date: Mon 15 Oct 2007 10:07:08 AM CST &nbsp; &nbsp; &nbsp;Build Host: hs20-bc2-2.build.redhat.com<br/>Group &nbsp; &nbsp; &nbsp; : Applications/File &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Source RPM: tree-1.5.0-4.src.rpm<br/>Size &nbsp; &nbsp; &nbsp; &nbsp;: 41796 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;License: GPL<br/>Signature &nbsp; : DSA/SHA1, Fri 19 Jan 2007 12:22:37 AM CST, Key ID 5326810137017186<br/>Packager &nbsp; &nbsp;: Red Hat, Inc. &lt;http://bugzilla.redhat.com/bugzilla&gt;<br/>URL &nbsp; &nbsp; &nbsp; &nbsp; : http://mama.indstate.edu/users/ice/tree/<br/>Summary &nbsp; &nbsp; : A utility which displays a tree view of the contents of directories.<br/>Description :<br/>The tree utility recursively displays the contents of directories in a<br/>tree-like format. &nbsp;Tree is basically a UNIX port of the DOS tree<br/>utility.<br/>-------------------------------------------------------------------------------------<br/>root@fixip:/var/cache/apt/archives# dpkg -p tree &nbsp;（当查询未安装包，用I）<br/>Package: tree<br/>Priority: optional<br/>Section: utils<br/>Installed-Size: 92<br/>Maintainer: Ubuntu MOTU Developers &lt;ubuntu-motu@lists.ubuntu.com&gt;<br/>Architecture: i386<br/>Version: 1.5.1.1-1<br/>Depends: libc6 (&gt;= 2.6-1)<br/>Size: 28414<br/>Description: displays directory tree, in color<br/> Displays an indented directory tree, using the same color assignments as<br/> ls, via the LS_COLORS environment variable.<br/> .<br/> &nbsp;Homepage: http://mama.indstate.edu/users/ice/tree/<br/>Original-Maintainer: Florian Ernst &lt;florian@debian.org&gt;<br/>-------------------------------------------------------------------------------------<br/>5:检验包完整<br/>rpm -V<br/>dpkg -s<br/></div><br/>下面说一下，处理那个安装包的问题。google了半天没有解决办法。自己man解决掉了。<br/><div class="code"><br/>1：首先判断一下/etc/apache2是谁提供的。（切忌：目录后面不要加&quot;/&quot;.）<br/>root@fixip:~# dpkg -S /etc/apache2<br/>apache2.2-common: /etc/apache2<br/>2：那就查一下覆盖命令（从dpkg -h获取）：<br/>root@fixip:~# dpkg --force-help<br/>dpkg forcing options - control behaviour when problems found:<br/> &nbsp;warn but continue: &nbsp;--force-&lt;thing&gt;,&lt;thing&gt;,...<br/> &nbsp;stop with error: &nbsp; &nbsp;--refuse-&lt;thing&gt;,&lt;thing&gt;,... &#124; --no-force-&lt;thing&gt;,...<br/> Forcing things:<br/> &nbsp;all &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Set all force options<br/> &nbsp;downgrade &#91;*&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Replace a package with a lower version<br/> &nbsp;configure-any &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Configure any package which may help this one<br/> &nbsp;hold &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Process incidental packages even when on hold<br/> &nbsp;bad-path &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PATH is missing important programs, problems likely<br/> &nbsp;not-root &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try to (de)install things even when not root<br/> &nbsp;overwrite &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Overwrite a file from one package with another<br/> &nbsp;overwrite-diverted &nbsp; &nbsp; Overwrite a diverted file with an undiverted version<br/> &nbsp;bad-verify &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Install a package even if it fails authenticity check<br/> &nbsp;depends-version &#91;!&#93; &nbsp; &nbsp;Turn dependency version problems into warnings<br/> &nbsp;depends &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Turn all dependency problems into warnings<br/> &nbsp;confnew &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Always use the new config files, don&#039;t prompt<br/> &nbsp;confold &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Always use the old config files, don&#039;t prompt<br/> &nbsp;confdef &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Use the default option for new config files if one<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is available, don&#039;t prompt. If no default can be found,<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; you will be prompted unless one of the confold or<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; confnew options is also given<br/> &nbsp;confmiss &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Always install missing config files<br/> &nbsp;conflicts &#91;!&#93; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Allow installation of conflicting packages<br/> &nbsp;architecture &#91;!&#93; &nbsp; &nbsp; &nbsp; Process even packages with wrong architecture<br/> &nbsp;overwrite-dir &#91;!&#93; &nbsp; &nbsp; &nbsp;Overwrite one package&#039;s directory with another&#039;s file<br/> &nbsp;remove-reinstreq &#91;!&#93; &nbsp; Remove packages which require installation<br/> &nbsp;remove-essential &#91;!&#93; &nbsp; Remove an essential package<br/><br/>WARNING - use of options marked &#91;!&#93; can seriously damage your installation.<br/>Forcing options marked &#91;*&#93; are enabled by default.<br/>3：<br/><br/><br/><br/></div>
]]>
</description>
</item><item>
<link>http://www.52zhe.cn/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] 从误删除/etc/apache2目录谈rpm与dpkg的包对比管理。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.52zhe.cn/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>