คำสั่งให้ล้างและติดตั้งแพ็กเกจใหม่


10

บางครั้งแพคเกจใช้งานไม่ได้และจำเป็นต้องติดตั้งใหม่ตั้งแต่ต้น ฉันสามารถใช้apt-get purgeตามด้วยapt-get installแต่จากนั้นฉันต้องคอยดูว่าแพ็กเกจใด ๆ ที่ติดตั้งได้ถูกถอนการติดตั้งและอย่าลืมติดตั้งใหม่อีกครั้ง

มีคำสั่งให้ล้างและติดตั้งแพคเกจที่จัดการการพึ่งพาหรือไม่ หากแพ็กเกจขึ้นอยู่กับแพ็คเกจที่ติดตั้งใหม่แพ็กเกจนั้นควรจะอยู่ในตำแหน่งเดิมหรือควรติดตั้งแพ็คเกจใหม่ด้วย


3
มีความเป็นไปได้ที่ซ้ำกันของแพคเกจติดตั้ง
muru

2
ไม่ฉันต้องการให้มันลบไฟล์การกำหนดค่าเช่นapt-get purge
Tor Klingberg

คำตอบ:


9

ก็ไม่แนะนำ แต่คุณสามารถตัดราคาและตรงไปยังaptdpkg

ตัวอย่างเช่นการpostfixและpostfix-dev:

$ sudo apt-get purge postfix
Reading package lists... Done
Building dependency tree
Reading state information... Done.
The following packages will be REMOVED:
  postfix* postfix-dev*
0 upgraded, 0 newly installed, 2 to remove and 99 not upgraded.
After this operation, 4449 kB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

ตอนนี้เราใช้dpkgเพื่อล้างpostfixโดยไม่ต้องลบผู้ติดตาม:

$ sudo dpkg --purge --force-depends postfix
dpkg: postfix: dependency problems, but removing anyway as you requested:
 postfix-dev depends on postfix (>= 3.1.0-0).
 postfix-dev depends on postfix (<< 3.1.0.0-0).
 postfix-dev depends on postfix (>= 3.1.0-0).
 postfix-dev depends on postfix (<< 3.1.0.0-0).

(Reading database ... 293223 files and directories currently installed.)
Removing postfix (3.1.0-3) ...
Purging configuration files for postfix (3.1.0-3) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...

และตอนนี้ติดตั้งใหม่postfix:

$ sudo apt-get install postfix
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common postfix-cdb postfix-doc
The following NEW packages will be installed:
  postfix
0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.
Need to get 0 B/1152 kB of archives.
After this operation, 3697 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously unselected package postfix.
(Reading database ... 293035 files and directories currently installed.)
Preparing to unpack .../postfix_3.1.0-3_amd64.deb ...
Unpacking postfix (3.1.0-3) ...
...
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.