Pacman
From ArchWiki
| i18n |
|---|
| Česky |
| Dansk |
| Deutsch |
| English |
| Español |
| Français |
| Italiano |
| Nederlands |
| Polski |
| Português de Portugal |
| Romanian |
| Русский |
| 简体中文 |
| 한국어 |
Contents |
Overview
The Pacman package manager is one of the great highlights of Arch Linux. It combines a simple binary package format with an easy-to-use build system (see makepkg and ABS). Pacman makes it possible to easily manage packages, whether they be from the official Arch repositories or the user's own builds.
Pacman keeps the system up to date by synchronizing package lists with the master server. This server/client model also allows you to download/install packages with a simple command, complete with all required dependencies.
Pacman is written in the C programming language, so it is fast, light and very agile. It uses the .tar.gz package format, which further enhances its speed; Gzipped tarballs, though slightly larger, are decompressed much faster than their Bzipped counterparts, and are therefore generally installed more expediently.
Usage
To really learn what pacman can do, read man pacman. The below is just a small sample of operations that can be performed.
Installing and Removing Packages
Before installing and upgrading packages, it is a good idea to synchronize the local package database with the remote repositories.
pacman -Sy
or
pacman --sync --refresh
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 refresh the package database before installing a package in one command:
pacman -Sy package_name
To remove a single package, leaving all of its dependencies installed:
pacman -R package_name
To 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.
pacman -Su
However, the best option is to synchronize the repository databases AND update your system in one go with the following:
pacman -Syu
Querying the Package Database
Pacman can search and query the local package database with the -Q flag. See
pacman -Q --help
or the pacman(8) manpage for more details. Sync databases can be searched and queried with the -S flag. See either the manpage just mentioned or
pacman -S --help
for details.
Other Usage
Pacman is quite an extensive package management tool, here is just a brief collection of other features.
- Download a package without installing it:
pacman -Sw package_name
- Install a local package (not from a repository):
pacman -U /path/to/package/package_name-version.pkg.tar.gz
You may also enter a URL:
pacman -U http://www.examplepackage/repo/examplepkg.tar.gz
- Fully clean the package cache (/var/cache/pacman/pkg):
pacman -Scc
- For removing orphans (recursively):
pacman -Rs $(pacman -Qtdq)
- For reinstalling all packages (at least the ones available in a repository):
pacman -S $(pacman -Qq | grep -v "$(pacman -Qmq)")
For a more detailed list of switches please refer to pacman --help or man pacman.
Configuration
Pacman configuration is located in /etc/pacman.conf. In depth information about the configuration file can be found in man pacman.conf.
General options
General options are in [options] section. Read the man page or look in the default pacman.conf for information on what can be done here.
Repositories
In this section you define which repositories to use, as referred to in /etc/pacman.conf. They can be defined directly there or you can include them from another file. All official repositories use the same /etc/pacman.d/mirrorlist file which contains a variable '$repo'. So you only need to maintain one list. The following is an example for the official repositories which have a lot of mirrors. Avoid using ftp.archlinux.org as it is throttled.
[core] # Add your preferred servers here, they will be used first Include = /etc/pacman.d/mirrorlist [extra] # Add your preferred servers here, they will be used first Include = /etc/pacman.d/mirrorlist [community] # Add your preferred servers here, they will be used first Include = /etc/pacman.d/mirrorlist
n.b. Care should be taken when using testing repository
Errors
If you receive the following error not found in sync db this likely due to the package not being located because the repository has not been set correctly.
Related links
man-pages:
other wiki-entries:
Improve Pacman Performance
Colored Pacman output
Downgrade packages
Editing pacman.conf
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 (Network Shared Pacman Cache)
rucksack
Pacman GUI Frontends
Pacman Aliases (for bash)
Mirrors