Polecenie wyczyszczenia i ponownej instalacji pakietu


10

Czasami pakiet jest zepsuty i należy go zainstalować od nowa. Mogę użyć, apt-get purgea następnie apt-get install, ale potem muszę sprawdzić, czy jakieś pakiety zależne zostały odinstalowane i pamiętać o ich ponownej instalacji.

Czy istnieje polecenie czyszczenia i ponownej instalacji pakietu, który obsługuje zależności? Jeśli pakiet zależy od tego, który zostanie ponownie zainstalowany, należy go zostawić na miejscu lub ponownie.



2
Nie, chcę, aby usunąć pliki konfiguracyjne, takie jakapt-get purge
Tor Klingberg,

Odpowiedzi:


9

To nie jest wskazane, ale możesz podciąć apti przejść bezpośrednio do dpkg.

Na przykład biorąc postfixi 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.

Teraz używamy dpkgdo czyszczenia postfixbez usuwania zależności:

$ 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) ...

A teraz zainstaluj ponownie 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) ...
...
Korzystając z naszej strony potwierdzasz, że przeczytałeś(-aś) i rozumiesz nasze zasady używania plików cookie i zasady ochrony prywatności.
Licensed under cc by-sa 3.0 with attribution required.