purge 和 dpkg -P 之间的区别?

purge 和 dpkg -P 之间的区别?

我必须从生产服务器中卸载 phpmyadmin,然后在 Google 上搜索并使用了这个:

sudo dpkg -P phpmyadmin

嗯,这个方法很好,但似乎 Ubuntu 上的其他人都在使用清除

sudo apt-get purge phpmyadmin 

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

答案1

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

关于 -p/purge ...

意思-Pdpkg--purge删除所有内容,包括设置和配置文件。摘自手册:

-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

purge在 中也同样如此apt-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 评论的文档:

相关内容