dpkg
dpkg is a package manager for Debian-based systems. It can install, remove, and build packages, but unlike other package management systems, it cannot automatically download and install packages or their dependencies. This section covers using dpkg to manage locally installed packages:
-
To list all packages installed on the system, from a terminal prompt type:
dpkg -l
-
In base a quanti pacchetto sono installati nel sistema, questo comando può generare molto output. È comunque possibile passare l'output attraverso una pipe all'applicazione grep per vedere se un particolare pacchetto è installato o meno:
dpkg -l | grep apache2
Sostituire apache2 con il nome di un qualsiasi altro pacchetto, parte del nome o qualsiasi altra espressione regolare.
-
Per elencare i file installati da un pacchetto, in questo caso ufw, digitare:
dpkg -L ufw
-
Se non si è sicuri di quale pacchetto abbia installato un file, usare il comando dpkg -S. Per esempio:
dpkg -S /etc/host.conf base-files: /etc/host.conf
L'output mostra che /etc/host.conf appartiene al pacchetto base-files.
Many files are automatically generated during the package install process, and even though they are on the filesystem, dpkg -S may not know which package they belong to.
-
Per installare un file .deb locale, digitare:
sudo dpkg -i zip_3.0-4_i386.deb
Change zip_3.0-4_i386.deb to the actual file name of the local .deb file you wish to install.
-
Per disinstallare un pacchetto:
sudo dpkg -r zip
Uninstalling packages using dpkg, in most cases, is NOT recommended. It is better to use a package manager that handles dependencies to ensure that the system is in a consistent state. For example using dpkg -r zip will remove the zip package, but any packages that depend on it will still be installed and may no longer function correctly.
Per le ulteriori opzioni di dpkg, consultare la pagina di manuale: man dpkg.