pacman package manager
Managing pacman packages in Arch Linux and derivatives (Manjaro, endeavourOS).
Generating a list of packages
List non-AUR, explicitly installed packages:
pacman -Qnqe > pkgs.txtList AUR packages:
pacman -Qqem > aurpkgs.txtList all explicitly installed packages:
pacman -Qqe > allpkgs.txtInstall packages from a list
pacman -Syu # Full upgrade the system first
pacman -S --needed - < pkgs.txtArch User Repository (AUR)
The Arch User Repository (AUR) hosts community-contributed PKGBUILDs, instructions to download and build a packages.
While you could clone the PKGBUILD files and run makepkg -si manually, AUR helpers automate these process, giving a similar experience for installing regular packages in pacman.
pikaur
pikaur reviews PKGBUILDs all in once and asks all questions before installing/building, using systemd dynamic users to spawn build processes.
You can install pikaur by another AUR helper, for example:
yay -S pikaurAfterwards, you can install AUR packages as if installing regular ones
sudo pikaur -S google-chromeTo update all packages
sudo pikaur -Syuparu
paru is an AUR helper written in Rust.
yay -S paru-bin # If you don't want to compile the Rust code
# yay -S paru # Compile paru from sourceAfterward, you can install AUR packages as if installing regular ones
paru -S google-chromeTo update all packages
paruyay
yay is an AUR helper written in Go and is directly available in Manjaro/EnOS.
You can install AUR packages as if installing regular ones
yay -S google-chromeTo update all packages, just type
yayDefault options for yay could be saved using yay --save <options>, for example:
yay --answerclean All --answerdiff None --answerupgrade None --cleanafter --batchinstall --combinedupgrade --sudoloop --saveExplanation:
--cleanafter: clean untracked files after build.--combinedupgrade: resolve dependency and then install both the repo and the AUR packages in one go.--sudoloop: Loop sudo calls in the background to prevent sudo from timing out during long builds.--batchinstall: Build all AUR packages and install them at once.
Compilation options for AUR packages
To customize compilation options, a good starting point is to copy from the system-wide config file:
cp /etc/makepkg.conf ~/.makepkg.confto you own ~/.makepkg.conf makepkg@ArchWiki. However, PKGBUILD settings in the packages still have higher priorities and can override your settings.
CPU target for building optimized binaries
CFLAGS="-march=native -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="${CFLAGS}"
RUSTFLAGS="-C opt-level=2 -C target-cpu=native"Parallel compilation
MAKEFLAGS="-j$(nproc)"Compressing packages
# multiple cores on compression of xz archives
COMPRESSXZ=(xz -c -z - --threads=0)
# multiple cores on compression of zstd archives
COMPRESSZST=(zstd -c -z -q - --threads=0)
# multiple cores on compression of gz archives (requires pigz package)
COMPRESSGZ=(pigz -c -f -n)And you can choose the preferred method for package compression. For example,
PKGEXT='.pkg.tar.zst'Or turn off compression completely (fastest)
PKGEXT='.pkg.tar'