Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end
Pacman can keep a system up to date by synchronizing package lists with the master server, making it a breeze for the security-conscious system administrator to maintain. This server/client model also allows you to download/install packages with a simple command, complete with all required dependencies (similar to Debian's apt-get).
Pacman NB: Pacman was written and is being maintained by Judd Vinet, the creator of Arch Linux. But it is used as a package management tool by other distros as well, such as FrugalWare (see also []), Rubix, UfficioZero (in Italian, based on Ubuntu!!), and of course ArchLinux-derivatives such as Archie and AEGIS.
Pacman is both a binary and source package manager. It combines several ideas from FreeBSD, Debian and Slackware to form one of the most extensive yet easy to use package managers available for GNU/Linux. Pacman is able to download, install and upgrade packages from both remote and local repositories with full dependency handling, and has easy to understand tools for crafting your own packages too.
Installing and Removing Packages
Before installing and upgrading packages, it is a good idea to synchronize the local packages database with the remote repositories.
To install or upgrade a single package or list of packages (including dependencies), issue the following command:
pacman -S package_name1 package_name2
Sometimes there are more versions of a package in different repositories (e.g. extra and testing). You can specify which one to install:
pacman -S extra/package_name pacman -S testing/package_name
You can also combine parameters at once, for example this will both synchronize the package database and install a package:
pacman -Sy package_name
To remove a single package, leaving all of its dependencies installed:
pacman -R package_name
To also remove all of the packages dependencies which aren't used by any other installed package:
pacman -Rs package_name
Upgrading the System
Pacman can update all packages on the system with just one command. This could take quite a while depending on how up-to-date your system is.
NB: you can synchronise the repository databases AND update your system in one go with
It is actually good practice to run the above command every few days.
Querying the Package Database
Pacman can search the package database for a list of packages, you can enter part of the package name to search for all packages matching the string.
pacman -Ss package
To just search installed packages:
pacman -Qs package
Once you know the name of the package you are looking for, you can display some information on the package.
pacman -Si package pacman -Qi package
For a list of files contained in a package:
pacman -Ql package
You can also query what package a file on your system belongs to.
pacman -Qo /path/to/a/file
Simultaneously Searching Repositories and Installed Packages
You can use the following bash script to do the equivalent of simultaneously calling pacman -Ss foo and pacman -Qs foo, in order to see which of the packages listed are actually installed on your system. The latter will be flagged with an asterisk.
#!/bin/bash if [ -z "$1" ]; then echo "usage: pacsearch [regex pattern]" echo "usage: pacsearch -h|--help" exit 0 fi if [ "$1" = "-h" -o "$1" = "--help" ]; then echo "usage: pacsearch [regex pattern]" echo " Like pacman -Ss [regex pattern] but installed packages are flagged with a *" echo "usage: pacsearch -h|--help" echo " Prints this message. No other options allowed" exit 0 fi firstchar=`echo "$1" | cut -c1` if [ $firstchar = "-" ]; then echo "Sorry, $1 is not a valid option!" echo "usage: pacsearch [regex pattern]" echo "usage: pacsearch -h|--help" exit 0 fi instpkg=`pacman -Qs $1 | egrep '^[^ ]' | sed 's|^local/||' | sed 's/ .\+$//'` syncdump=`mktemp` pacman -Ss $1 > $syncdump for pkg in $instpkg; do sed -i "s@^\(.\+/$pkg\) @\*\1 @" $syncdump done cat $syncdump
Save the script somewhere in your path (e.g. ~/bin/) and name it pacsearch. Make it executable with
chmod a+x pacsearch
Now if you type for example
the output could look like this:
extra/qca 1.0-1 QT Cryptography Architecture extra/qsynth 0.2.5-1 Qt GUI for fluidsynth *extra/qt 3.3.5-8 The QT gui toolkit. extra/qt-doc 3.3.5-1 The QT gui toolkit documentation. extra/qtella 0.6.5-1 Qtella is a Gnutella client for Linux using QT extra/qtiplot 0.7.7-1 Data analysis and scientific plotting - free clone of Origin extra/qtparted 0.4.5-3 A Partition Magic clone written in C++ using the Qt toolkit extra/qwt 4.2.0-3 Qt Widgets for Technical Applications extra/qwtplot3d 0.2.6-2 Qt/OpenGL-based C++ programming library containing 3d-widgets
So in this case you would know that none of the above packages are installed on your system except qt itself.
NB1: a request has been filed on flyspray to integrate the above functionality in pacman itself, so the 'dirty' bash trick might become superfluous with a future version of pacman.
NB2: you can modify the above bash script on the basis of this wiki to have installed packages colored differently in the output.
Pacman is quite an extensive package management tool, below are some other features.
- Downloading a package without installing it:
pacman -Sw package_name
- Installing a local package (not from repository):
pacman -A /path/to/package/package_name-version.pkg.tar.gz
- Cleaning pacman's cache (/var/cache/pacman/pkg):
For a more detailed list of switches please refer to pacman --help or man pacman.
Pacman configuration is located in
/etc/pacman.conf. There are two main sections in the file:
General options are in [options] section. You can specify here which files should not be upgraded. This is useful for important system files. The syntax is very simple:
NoUpgrade = etc/passwd etc/group etc/shadow etc/sudoers NoUpgrade = etc/fstab etc/raidtab etc/ld.so.conf NoUpgrade = etc/rc.conf etc/rc.local NoUpgrade = etc/modprobe.conf etc/modules.conf NoUpgrade = etc/lilo.conf boot/grub/menu.lst
Another useful option is IgnorePkg. For example if you have modified or patched a certain package, adding it to the IgnorePkg line will prevent pacman from upgrading it when a new version becomes available. But pacman will still warn you about the newest available version, so you can eventually decide to update your customized version. This option is also useful for LARGE packages like openoffice-base if you want to avoid downloading and updating the whole lot every time there is a minor update in the repository. Since pacman warns you about the latest version anyway, you can decide to upgrade manually if you wish.
In this section you define which repositories to use. They can be defined directly there or you can include them from another file. The latter is useful for the official repositories which have a lot of mirrors.
[repository-name] Server = ftp://server.net/repo
[current] # Add your preferred servers here, they will be used first Include = /etc/pacman.d/current
For more information please refer to man pacman.
Colored Pacman output
Redownloading all installed packages
Server configuration in pacman.conf
ArchLinux User-community Repository (AUR)
Local repository HOW-TO
Custom local repository with ABS and gensync
Howto Upgrade via Home Network
Pacman GUI Frontends