ความแตกต่างระหว่างการกำจัดและ dpkg -P?


9

ฉันต้องถอนการติดตั้ง phpmyadmin จากเซิร์ฟเวอร์ที่ใช้งานจริงและ googled สำหรับมันและใช้สิ่งนี้:

sudo dpkg -P phpmyadmin

มันใช้งานได้ดี แต่ดูเหมือนว่าทุกคนใน Ubuntu กำลังใช้การล้างข้อมูลแทน

sudo apt-get purge phpmyadmin 

ฉันทำอะไรผิดหรือเปล่า? ผลที่ตามมาใด ๆ ที่ฉันควรระวัง (เป็นเซิร์ฟเวอร์ที่ใช้งานจริงหลังจากนั้น) phpmyadmin ทุกบิตถูกถอนการติดตั้งผ่าน dpkg -P จริงหรือไม่


จากหน้า man ของ dpkg มันบอกว่า "-P, --purge package" ดังนั้น -P ย่อมาจาก 'purge' ดังนั้นอย่างที่ฉันคิดว่ามันควรเป็นสิ่งเดียวกัน ฉันใช้ 'apt-get purge'
เป็นการส่วนตัว

คำตอบ:


5

dpkgและapt-getมีวิธีติดตั้งซอฟต์แวร์ 2 วิธี โดยพื้นฐานแล้ว apt-get, aptitude และ synaptic นั้นถูกสร้างขึ้นจากโปรแกรมจัดการแพคเกจ dpkg ของเดเบียน พวกเขาทั้งหมดทำหน้าที่พื้นฐานเหมือนกัน - การจัดการแพ็คเกจ แต่มีคุณสมบัติพิเศษบางอย่าง หนึ่งในคุณสมบัติพิเศษของ apt-get คือมันจะติดตั้งการพึ่งพาและ dpkg ไม่ได้

เกี่ยวกับ -p / purge ...

-Pในdpkgวิธีการ--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 SAPIs อื่น) aptสามารถจัดการกับสิ่งนี้dpkgไม่สามารถทำมันเอง
Lekensteyn

เลิศเลอเลิศ ก็ยังคงมองไปใน (เพราะสิ่งที่พึ่งพาสิ่งที่จู้จี้ฉัน) เพิ่มเข้าไปใน :) อย่าลังเลที่จะแก้ไขคำตอบของฉันหากคุณมีมากขึ้น: D
Rinzwind

ก็ปรับ :) ถ้ามีคนฮิตปัญหาการพึ่งพาหลังจากใช้dpkgโดยตรง (s) เขาสามารถแก้ไขได้ด้วยsudo apt-get install -f(แนะนำโดยdpkg)
Lekensteyn

ขอบคุณทุกคนสำหรับคำแนะนำของคุณ ดังนั้นฉันจะทำsudo apt-get install -f phpmyadminในกรณีของฉันเพื่อให้แน่ใจว่ามีการลบการอ้างอิง? จะทำอย่างไรถ้ามีการแบ่งปันการพึ่งพา
Houman

@Kave Dependencies ที่ไม่ได้ติดตั้งด้วยตนเองจะถูกลบเมื่อไม่มีแพ็คเกจที่ติดตั้งขึ้นอยู่กับพวกเขา
nanofarad
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.