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

Hou*_*man 9 apt dpkg

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

sudo dpkg -P phpmyadmin
Run Code Online (Sandbox Code Playgroud)

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

sudo apt-get purge phpmyadmin 
Run Code Online (Sandbox Code Playgroud)

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

Rin*_*ind 5

dpkg并且apt-get是 2 种不同的软件安装方式。基本上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
Run Code Online (Sandbox Code Playgroud)

这同样适用于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).
Run Code Online (Sandbox Code Playgroud)

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

来自 Lekensteyn 评论的文档: