Aperçu de Pacman
Aperçu
Le gestionnaire de paquets de Manjaro, Pamac, est fourni avec la plupart des éditions de Manjaro. Toutes les éditions de Manjaro incluent pacman, le gestionnaire de paquets de la version amont d'Arch Linux. Pacman comprend certaines fonctionnalités avancées que l'on ne trouve pas dans Pamac.
Key points to know:
- Pacman est installé par défaut dans Manjaro Linux.
- Pacman est principalement développé et maintenu par les développeurs d'Arch Linux
- Pacman ne peut être utilisé qu'en ligne de commande. Si vous préférez un gestionnaire de paquets graphique, veuillez consulter Pamac ou Octopi.
- Pacman ne peut utiliser que le dépôt officiel de Manjaro repository. Il existe des articles distincts pour accéder au Arch User Repository(AUR), pour utiliser flatpaks ou pour utiliser snaps
Mises à jour
To update the package database and update all packages on the system
sudo pacman -Syu
To force a full refresh of the package database and update all packages on the system. You must do this when switching branches or switching mirrors.
sudo pacman -Syyu
To force a full refresh of the package database, update all packages on the system and allow packages to be downgraded. Downgrading should be only be needed when switching to an older branch. For example, switching from Testing to Stable.
sudo pacman -Syyuu
Recherche de paquets
To search the Manjaro repositories for available packages you can use the command pacman -Ss keyword
. It will search both the package name and the description for the keyword. For example, to search for packages containing the keyword smplayer you could use:
pacman -Ss smplayer
You can search your installed packages in the same manner using -Qs
instead of -Ss
. To search your installed packages for smplayer:
pacman -Qs smplayer
Once you have found a package you can use pacman -Qi
to get more information about an installed packages or pacman -Si
for packages in the repos. Following the example above you could use
pacman -Si smplayer
Finally, for a list of all installed packages on your system, enter the following command:
pacman -Ql
Installation de paquets
To install a software package, the basic syntax is pacman -S packagename
. However, installing a package without updating the system will lead to a partial upgrade situation so all the examples here will use pacman -Syu packagename which will install the package and ensure the system is up to date
. For example, to install smplayer the command is:
sudo pacman -Syu smplayer
You will then be presented a list of software to install. You may notice this list has more packages than you requested. This is because many packages also have dependencies which are packages that must be installed in order for the software you selected to function properly.
Pacman can also directly install packages from the local system or a location on the internet. The format of that command is pacman -U packagelocation
. For example, to install a copy of your package cache you could do something like:
sudo pacman -U /var/cache/pacman/pkg/smplayer-19.5.0-1-x86_64.pkg.tar.xz
Alternatively, you could get it directly from one of Manjaro's mirrors:
sudo pacman -U https://mirror.alpix.eu/manjaro/stable/community/x86_64/smplayer-19.5.0-1-x86_64.pkg.tar.xz
Suppression de paquets
To remove a software package, the basic syntax is sudo pacman -R packagename
. We could remove the smplayer package we installed above with:
sudo pacman -R smplayer
This will remove the package, but will leave all the dependencies behind. If you also want to remove the unneeded dependencies you could use pacman -Rsu packagename
as seen in this example:
sudo pacman -Rsu smplayer
Sometimes when you try to remove a package you will not be able to because there are other packages which depend on it. You can use pacman -Rc packagename
to remove a package and everything that depends on it. Be careful to heed the above warning when using this option.
sudo pacman -Rc smplayer
The most nuclear option is pacman -Rcs packagename
. This will remove everything that depends on packagename and continue to do so on its dependencies. This should really only be used in exceptional circumstances such as when removing an entire desktop environment and trying not to leave anything behind.
Pacman usually also creates backup configuration files when deleting packages. To remove those, you can add n
to any of the examples above. For example:
sudo pacman -Rn smplayer sudo pacman -Rsun smplayer sudo pacman -Rcn smplayer
Affichage et suppression des orphelins
To list all orphans, installed packages that are not used by anything else and should no longer be needed:
pacman -Qdt
To remove all the orphans:
sudo pacman -Rs $(pacman -Qdtq)
Téléchargement de paquets sans installation
In some cases it may be useful to download a package without installing. For example, to install on a different system that is not connected to the internet. This can be done with pacman -Sw packagename
. For example:
sudo pacman -Sw smplayer
The package and any rerquired dependencies will be downloaded to your pacman cache at /var/cache/pacman/pkg
Déterminer quel paquet possède un fichier
It is often useful to understand which package installed a file on your system. This is easy to do with pacman using pacman -Qo /path/to/filename
. For example:
pacman -Qo /usr/bin/smplayer
Nettoyage du cache
When pacman installs packages, it keeps a copy of all the old packages you have downloaded. This cache can be very useful if you have to install older packages in an emergency. However, left unchecked, this cache will grow very large over time. Systems running Pamac will already have access to its automated pacman cache cleaning functions. It is also possible to clean them manually using pacman.
To clear the cache of packages that are no longer installed, enter the following command:
sudo pacman -Sc
Otherwise, to clear the cache completely, enter the following command (and use with care):
sudo pacman -Scc
A safer way to remove old package cache files is to remove all packages except for the latest three package versions using paccache
:
paccache -rvk3
Le fichier de configuration, pacman.conf
Les paramètres de Pacman sont situées dans le fichier /etc/pacman.conf
. Le propriétaire de ce fichier est root, voir this guide si vous souhaitez plus d'information sur les possibilités d'édition de ce type de fichier. On trouvera une documentation complète de ces options sur le lien Arch Linux référence ci-dessous. Cette documentation met en évidence plusieurs options particulièrement intéressantes pour les utilisateurs de Manjaro.
Activation de la sortie couleur
Par défaut, la sortie de pacman est monochrome, mais l'activation de la sortie couleur peut faciliter la lecture si votre terminal prend en charge les couleurs. Cela peut être activé en décommettant ou en ajoutant la ligne suivante au fichier
Color
Affichage de Pacman qui mange
Si vous vous ennuyez de simplement regarder des lignes de hachage lors du téléchargement d'applications dans le terminal, pourquoi ne pas changer la barre de progression en Pacman mangeant des pilules énergétiques à la place? Pour activer ceçi, ajoutez simplement la ligne:
ILoveCandy
Dépannage
Une page distincte pour le dépannage de pacman est disponible içi.