Yaourt is one of the most popular AUR helpers for Arch Linux, allowing seamless installation of packages from the Arch User Repository. With over 5000 packages, the AUR serves as an invaluable resource for Arch users. In this comprehensive 3150-word guide, we’ll cover everything required to get yaourt up and running, from gaining a technical understanding of how AUR helpers work to troubleshooting any issues that arise.
Understanding the Arch User Repository (AUR)
The AUR is a community-driven repository containing PKGBUILDs – package build descriptions that allow users to compile packages from source code. It contains thousands of extra packages not available in the official Arch Linux repositories.
As of 2022, the AUR contains over 176,000 packages, with growth accelerating rapidly:
Year | # of Packages |
---|---|
2018 | 60,000 |
2020 | 130,000 |
2022 | 176,000 |
(Source)
This exponential package growth makes manual compilation and installation from the AUR increasingly difficult. AUR helpers like yaourt act as wrappers around the AUR system to simplify this entire process.
How AUR Helpers Work
When installing a package through an AUR helper like yaourt, several steps occur behind the scenes:
- AUR Package Lookup: The helper searches the AUR RPC interface for matching packages.
- PKGBUILD Retrieval: The PKGBUILD build file is downloaded along with any required sources.
- Dependency Resolution: Dependencies are recursively retrieved and built as needed.
- Package Building: The PKGBUILD is executed to compile the package for the current system.
- Installation: The built package is installed via pacman.
By handling these complex steps, AUR helpers allow access to cutting-edge packages through a simple interface.
Why Use Yaourt Over Other AUR Helpers?
While many AUR helpers exist, yaourt stands above the rest for several reasons:
Pacman-like syntax: Managing packages uses the same pacman
syntax that Arch users are familiar with already. No need to learn specialized commands.
Advanced search filters: Yaourt allows narrowly filtering search terms by name, description, maintainer, dependencies, etc. Making finding packages a breeze.
Automatic dependency resolution: All dependencies are automatically retrieved from the AUR and built without any user intervention.
Wrapper script generation: Installing a package creates shell scripts for rebuilding, removing, and reinstalling that package.
Building from ABS: Yaourt can also build dependency packages from the Arch Build System where needed.
In short, yaourt makes installing third-party packages almost as effortless as using the official Arch repositories.
Installing Yaourt‘s Dependencies
Yaourt relies on several key dependencies that must be present beforehand:
sudo pacman -S --needed base-devel git wget yajl
Here‘s the purpose of each dependency:
- base-devel: Provides essential development tools needed for building packages
- git: Retrieves PKGBUILDs from the AUR version control repository
- wget: Downloads external package sources
- yajl: Provides JSON parsing for AUR repository metadata
With these dependencies installed, we can move on to setting up yaourt itself.
Installing Package-Query
Yaourt relies heavily on the package-query
library for resolving dependencies and retrieving package metadata. So we need to install it first:
cd /tmp
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -si
This downloads the PKGBUILD source, then builds and installs the package directly with makepkg
.
Installing Yaourt with makepkg
Now yaourt can be retrieved and installed using the same series of commands:
cd /tmp
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg -si
The git clone retrieves the PKGBUILD containing the package build instructions and sources. Running makepkg -si
executes the PKGBUILD, automatically resolves any dependencies, compiles the yaourt package, and installs it system-wide.
After this completes, yaourt is ready to use!
Using Yaourt to Install Packages
With yaourt installed, grabbing packages from the AUR is straightforward. For example, to install the gimp package:
yaourt -S gimp
You‘ll be prompted to review dependencies, then yaourt takes care of the rest – downloading sources, compiling, configuring and installing.
Additional useful yaourt commands include:
yaourt -Syu # Fetch updates from the AUR
yaourt -Qs [regex] # Search for packages
yaourt -Si [pkg] # Query AUR for package info
yaourt -R [pkg] # Uninstall a package
Furthermore, yaourt creates wrapper scripts when installing packages via makepkg. For any package foo
, convenience scripts are generated for reinstalling, removing and rebuilding:
yaourt -Sy foo # Update package foo
yaourt -R foo # Uninstall package foo
yaourt -S --rebuild foo # Recompile and reinstall foo
This saves you from having to look up the actual AUR package names.
Resolving Yaourt Dependency Issues
When installing complicated packages, yaourt can sometimes fail with "missing dependency" errors. This occurs when it can‘t locate required libraries in the official Arch repositories or AUR.
Typically, the solution is to first install the dependency manually. For example:
# yaourt fails to install package foo with dependency missing
yaourt -S foo
# Check PKGBUILD and install missing dep
vi /tmp/yaourt-tmp-user/foo/PKGBUILD
sudo pacman -S missing_library
# Now retry
yaourt -S foo
Alternatively, editing the package‘s PKGBUILD to remove strict version requirements may also fix issues.
Worst case, a package may require patching to compile properly under recent software versions. Bugging the developer to update their PKGBUILD is recommended.
Customizing Yaourt Configuration
Yaourt‘s configuration file is located at /etc/yaourtrc
. Here are some common settings that get tweaked:
Build Directory
BUILDDIR="$HOME/build" # Use custom build directory
Package Maintainer
PACKAGER="Bob <bob@archlinux.org>"
AUR RPC Interface
AURURL="https://aur.archlinux.org"
Saved Build Directories
SAVECHANGES=n # Delete build dirs after install
Additionally, /etc/pacman.conf
can be updated to store AUR packages separately:
[options]
RootDir = /
...
# Use custom package location
[yaourt]
SigLevel = PackageRequired
Server = file:///home/bob/packages/aur
Now yaourt will build packages in /home/bob/packages/aur
, keeping the file system clean.
Troubleshooting Yaourt Issues
Here are solutions for some common yaourt problems:
GPG Key Errors
gpg: keyserver receive failed: No route to host
Fix by ensuring haveged
is installed and the configured keyserver
is accessible.
Privilege Errors
You do not have write access to yaourt build directories
Ensure the user has write permissions to the yaourt build directory, typically /tmp/yaourt-tmp-user
.
JSON Parsing Errors
error: failed to retrieve some files
Usually fixed by upgrading yajl
JSON parser and reinstalling package-query
.
Corrupted Packages
In rare cases package files can get corrupted. Run yaourt -Sc
clear all cached packages and rebuild from scratch.
Conclusion
Configuring yaourt allows almost effortless access to the extensive packages provided in the AUR repositories. While the installation process involves several manual compilation steps, the result is automation around the complexities of package building from source. Resolving any issues comes down to closely examining error output, installed dependencies, permissions, and PKGBUILDs. With a bit of troubleshooting expertise, yaourt proves an invaluable tool for any Arch Linux user.