清除和dpkg -P之间的区别?


9

我不得不从生产服务器上卸载phpmyadmin并用谷歌搜索并使用了它:

sudo dpkg -P phpmyadmin

好吧,这很好,但是似乎Ubuntu上的其他所有人都在使用清除功能

sudo apt-get purge phpmyadmin 

我做错了什么吗?我应该意识到的任何后果(毕竟这是我的生产服务器)phpmyadmin的所有位是否真的通过dpkg -P卸载了?


在dpkg的手册页中,它表示“ -P,-purge package”,因此-P代表“ purge”,因此,就我而言,它应该是同一件事。我个人使用'apt-get的净化'
hytromo

Answers:


5

dpkgapt-get两种安装软件的方式。基本上,apt-get,aptitude和synaptic是在debian的dpkg软件包管理程序的基础上构建的。它们都执行相同的基本功能-程序包管理,但具有一些额外的功能。apt-get的额外功能之一是它将安装依赖项,而dpkg不会。

关于-p / purge ...

-Pdpkg手段--purge和将删除一切,包括setttings和配置文件。从手册中:

-r, --remove, -P, --purge package...|-a|--pending

          Remove  an  installed  package. -r or --remove remove everything
          except conffiles. This may avoid having to reconfigure the pack‐
          age  if  it  is  reinstalled later. (Conffiles are configuration
          files that are listed in the DEBIAN/conffiles control file).  -P
          or  --purge  removes  everything,  including conffiles. If -a or
          --pending is given instead of a package name, then all  packages
          unpacked,   but   marked   to  be  removed  or  purged  in  file
          /var/lib/dpkg/status, are removed or purged, respectively. Note:
          some  configuration  files might be unknown to dpkg because they
          are created and handled  separately  through  the  configuration
          scripts. In that case, dpkg won't remove them by itself, but the
          package's postrm script (which is called by dpkg), has  to  take
          care of their removal during purge. Of course, this only applies
          to files in system directories, not configuration files  written
          to individual users' home directories.

          Removing of a package consists of the following steps:

          1. Run prerm script

          2. Remove the installed files

          3. Run postrm script

这同样适用于purgeapt-get

 remove
       remove is identical to install except that packages are removed
       instead of installed. Note the removing a package leaves its
       configuration files in system. If a plus sign is appended to the
       package name (with no intervening space), the identified package
       will be installed instead of removed.


 purge
       purge is identical to remove except that packages are removed and
       purged (any configuration files are deleted too).

基本上,这是相同的选择。请注意:dpkg不会删除依赖项。apt-get确实删除了依赖项

Lekensteyn的评论文档:


+1即将写出类似的答案。文档:debian.org/doc/manuals/debian-faq/ch-pkgtools.en.html。依赖项应突出显示。示例:删除php5也会导致phpmyadmin被删除(假设没有其他PHP SAPI)。apt可以解决这个问题,dpkg本身无法解决。
Lekensteyn

优秀的lekensteyn。仍在寻找(因为依赖关系让我很讨厌)。在:)中添加了它:如果您还有更多内容,请随时编辑我的答案:D
Rinzwind '04

很好:)如果有人在dpkg直接使用后遇到依赖项问题,则可以用sudo apt-get install -f(如的建议dpkg)进行纠正
Lekensteyn 2012年

感谢大家的建议。那么我是否sudo apt-get install -f phpmyadmin要确保删除依赖项?如果共享依赖关系怎么办?
霍曼2012年

如果没有安装的依赖包,则手动删除的@Kave依赖包将被删除。
nanofarad 2012年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.