« Debian » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(19 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 10 : | Ligne 10 : | ||
# suppression | # suppression | ||
sudo apt remove Mon_Paquet | sudo apt remove Mon_Paquet # conserve la configuration et les dépendances | ||
sudo apt purge Mon_Paquet | sudo apt purge Mon_Paquet # supprime la configuration mais conserve les dépendances | ||
# tester si un paquet est installé | # tester si un paquet est installé | ||
Ligne 42 : | Ligne 41 : | ||
# mise à jour des paquets déjà installés uniquement | # mise à jour des paquets déjà installés uniquement | ||
sudo apt upgrade | sudo apt upgrade | ||
# -s simulate the upgrade | |||
# mise à jour des paquets déjà installés + installe les nouvelles dépendances + désinstalle les anciennes dépendances | # mise à jour des paquets déjà installés + installe les nouvelles dépendances + désinstalle les anciennes dépendances | ||
sudo apt full-upgrade | sudo apt full-upgrade | ||
# upgrade a specific package only | |||
sudo apt install --only-upgrade <package_name> | |||
# know the installed and cadidate version of a package | |||
apt-cache policy <package_name> | |||
</kode> | </kode> | ||
== Recherche == | == Recherche == | ||
<kode lang=bash> | <kode lang=bash> | ||
# | # search a package | ||
apt search | apt search <package_name> | ||
apt search "regex" | |||
apt search "^ | apt search --names-only "^<package_name>$" # exact match | ||
# | |||
# search a package in the dpkg database (already installed packages) | |||
dpkg -l <package_name> | |||
dpkg -l "*<search_term>*" | dpkg -l "*<search_term>*" | ||
# ii: installed | |||
# rc: removed and configuration files are present | |||
# | # list installed packages | ||
apt list --installed | apt list --installed | ||
dpkg --get-selections | grep -v deinstall | dpkg --get-selections | grep -v deinstall | ||
dpkg -l | dpkg -l | ||
# lister tous les paquets explicitement installés par l'utilisateur | |||
apt-mark showmanual | |||
# set a package as manually installed | |||
sudo apt-mark manual <package> | |||
# set a package as automatically installed (dependency) | |||
sudo apt-mark auto <package> | |||
# info sur un paquet | # info sur un paquet | ||
apt show Mon_Paquet | apt show Mon_Paquet | ||
# lister les dépendances d'un paquet (tous les paquets qui seront désinstallé avec ce paquet) | # lister les dépendances d'un paquet (tous les paquets qui seront désinstallé avec ce paquet) | ||
Ligne 75 : | Ligne 89 : | ||
dpkg -S /path/file | dpkg -S /path/file | ||
apt-file search /path/file | apt-file search /path/file | ||
# list the files installed by a package | |||
dpkg -L <package_name> | |||
</kode> | </kode> | ||
* [https://linuxprograms.wordpress.com/2010/05/11/status-dpkg-list/ package status] | |||
== [http://manpages.ubuntu.com/manpages/bionic/man5/apt_preferences.5.html APT preferences file] == | |||
<filebox fn='/etc/apt/preferences'> | |||
# do not install any package which name starts with php8.0 and php8.1 | |||
Package: php8.0* php8.1* | |||
Pin: release * | |||
Pin-Priority: -1 | |||
</filebox> | |||
== Hold a package == | == Hold a package == | ||
Ligne 87 : | Ligne 113 : | ||
# show all packages on hold | # show all packages on hold | ||
apt-mark showhold | |||
</kode> | |||
== Clean == | |||
<kode lang='bash'> | |||
# get the space taken by the apt cache | |||
sudo du -sh /var/cache/apt | |||
sudo apt autoclean # remove the outdated packages | |||
sudo apt autoremove --purge # delete orphan packages, purge to also delete configuration | |||
# delete the entire apt cache | |||
sudo apt clean | |||
</kode> | </kode> | ||
Ligne 111 : | Ligne 149 : | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
# | # delete a key with its fingerprint | ||
sudo apt-key del | sudo apt-key del "B97B 0AFC AA1A 47F0 44F2 44A0 7FCC 7D46 ACCC 4CF8" | ||
#pub | #/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg | ||
#uid | #--------------------------------------------- | ||
# | #pub rsa4096 2011-10-13 [SC] | ||
# B97B 0AFC AA1A 47F0 44F2 44A0 7FCC 7D46 ACCC 4CF8 | |||
#uid [ unknown] PostgreSQL Debian Repository | |||
</kode> | |||
== Download == | |||
<kode lang='bash'> | |||
# download a package (deb file) in the current directory | |||
apt download <package_name> | |||
</kode> | </kode> | ||
Ligne 122 : | Ligne 168 : | ||
apt --fix-broken install | apt --fix-broken install | ||
</kode> | </kode> | ||
= Log = | |||
* {{boxx|/var/log/apt/history.log}} | |||
* {{boxx|/var/log/apt/term.log}} |
Dernière version du 26 novembre 2023 à 13:23
Liens
APT (Advanced Package Tool)
Installation
# installation sudo apt install Mon_Paquet # suppression sudo apt remove Mon_Paquet # conserve la configuration et les dépendances sudo apt purge Mon_Paquet # supprime la configuration mais conserve les dépendances # tester si un paquet est installé dpkg -l Mon_Paquet # localiser les fichiers installés du paquet dpkg -S Mon_Paquet # mise à jour de la liste des paquets disponible sudo apt update # mise à jour de tous les paquets installés sudo apt upgrade # installer un fichier *.deb dpkg -i paquet.deb # installer les dépendances manquantes sudo apt install -f # historique des installations cat /var/log/apt/history.log |
Mise à jour
# mise à jour de la liste des paquets disponible sudo apt update # mise à jour des paquets déjà installés uniquement sudo apt upgrade # -s simulate the upgrade # mise à jour des paquets déjà installés + installe les nouvelles dépendances + désinstalle les anciennes dépendances sudo apt full-upgrade # upgrade a specific package only sudo apt install --only-upgrade <package_name> # know the installed and cadidate version of a package apt-cache policy <package_name> |
Recherche
# search a package apt search <package_name> apt search "regex" apt search --names-only "^<package_name>$" # exact match # search a package in the dpkg database (already installed packages) dpkg -l <package_name> dpkg -l "*<search_term>*" # ii: installed # rc: removed and configuration files are present # list installed packages apt list --installed dpkg --get-selections | grep -v deinstall dpkg -l # lister tous les paquets explicitement installés par l'utilisateur apt-mark showmanual # set a package as manually installed sudo apt-mark manual <package> # set a package as automatically installed (dependency) sudo apt-mark auto <package> # info sur un paquet apt show Mon_Paquet # lister les dépendances d'un paquet (tous les paquets qui seront désinstallé avec ce paquet) apt depends Mon_Paquet # lister les dépendances inverse d'un paquet (tous les paquets qui ont une dépendance vers ce paquet) apt rdepends --installed Mon_Paquet # recherche à quel paquet appartient un fichier dpkg -S /path/file apt-file search /path/file # list the files installed by a package dpkg -L <package_name> |
APT preferences file
/etc/apt/preferences |
# do not install any package which name starts with php8.0 and php8.1 Package: php8.0* php8.1* Pin: release * Pin-Priority: -1 |
Hold a package
Prevent the package from being automatically installed, upgraded or removed.
# hold a package sudo apt-mark hold <package-name> # unhold a package sudo apt-mark unhold <package-name> # show all packages on hold apt-mark showhold |
Clean
# get the space taken by the apt cache sudo du -sh /var/cache/apt sudo apt autoclean # remove the outdated packages sudo apt autoremove --purge # delete orphan packages, purge to also delete configuration # delete the entire apt cache sudo apt clean |
Dépôts
# ajouter un dépôt sudo add-apt-repository ppa:<repository-name> # supprimer un dépôt sudo add-apt-repository -r ppa:<repository-name> # lister les dépôts cat /etc/apt/sources.list cat /etc/apt/sources.list.d/* |
Clés
# lister les clés apt-key list # télécharger et ajouter une clé curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # delete a key with its fingerprint sudo apt-key del "B97B 0AFC AA1A 47F0 44F2 44A0 7FCC 7D46 ACCC 4CF8" #/etc/apt/trusted.gpg.d/apt.postgresql.org.gpg #--------------------------------------------- #pub rsa4096 2011-10-13 [SC] # B97B 0AFC AA1A 47F0 44F2 44A0 7FCC 7D46 ACCC 4CF8 #uid [ unknown] PostgreSQL Debian Repository |
Download
# download a package (deb file) in the current directory apt download <package_name> |
Problème
apt --fix-broken install |
Log
- /var/log/apt/history.log
- /var/log/apt/term.log