Arch Linux

Arch Linux Package System

Arch Linux is a lean and highly customizable distribution of the Linux operating system, and one of its biggest strengths is its package system. Although package management in Arch Linux may seem complicated, especially to those who’ve never used Linux before, it’s actually just as simple and efficient as the rest of the operating system.

Arch Build System (ABS)

The core of package management in Arch Linux is the Arch Build System (ABS), a system for building software from source code. ABS has three main components:

  • SVN tree: a directory structure with the files needed to build all official packages.
  • PKGBUILD: a script with the information required to build Arch Linux packages.
  • makepkg: a script that automates the building of packages using PKGBUILDs.

However, Arch Linux doesn’t require its users to build packages from source code like some other Linux distributions do. Instead, software packages created and maintained by Arch Linux developers and Trusted Users can be readily downloaded for installation from several official repositories.

Official Repositories

The most important official repository is called core, and it contains packages for booting Arch Linux, connecting to the internet, building packages, managing and repairing file systems, and packages related to the system setup process. Because all Arch Linux users depend on the core repository, core packages must pass a rigorous signoff process before they are accepted and included in the repository.

In the past, the core repository contained Judd Vinet’s, the creator of Arch Linux, preferred applications, and everything else went into a repository called unofficial. A bulk of those additional packages now reside in a repository called extra, Xorg, window managers, web browsers, media players, and other applications and tools.

Before packages graduate to core or extra, they spend some time in the testing repository. It’s not advisable for regular users to enable the testing repository as it may result in a broken system.

Arch Linux developers are busy people, and it’s understandable that they can’t maintain every piece of software Arch Linux users would like to have at their disposal. For this reason, the community repository has been created to be maintained by Trusted Users. You can see the current list of Trusted Users here. It’s possible for community packages to eventually graduate to core or extra, provided they become popular enough.

All packages included in the official repositories of Arch Linux can be browsed and downloaded using this convenient web-based front-end. Each package includes information about its architecture, repository, upstream URL, license, maintainers, size, and date, as well as a short description that summarizes what the package does.

Unofficial Repositories

Besides official repositories, Arch Linux users can also download software from a number of unofficial repositories. For example, there’s an unofficial repository with ATI Catalyst proprietary drivers or with Android development tools.

pacman

Downloading and installing software packages from both official and unofficial repositories is typically accomplished using pacman, a powerful package manager that makes it possible to manage packages with simple commands.

To install a package with pacman, you simply issue the following command:

# pacman -S package_to_install

To search for a package:

$ pacman -Ss search_term

To remove a package:

# pacman -R package_to_remove

To update all packages on the system:

# pacman -Syu

pacman is one of the most distinguishing features of Arch Linux, and its mastery is essential for making the most out of the distribution.

The good news for all newbies who feel intimidated by the command line is that there are many pacman wrappers whose purpose is to make working with packages using pacman much easier. Included among them are pacli, a simple and interactive Bash frontend for pacman, and PacUI, which provides useful and advanced pacman commands in a convenient and easy to use text interface.

AUR

One feature of Arch Linux that has made it particularly popular among Linux enthusiasts and tinkerers is Arch User Repository (AUR), a community-driven repository for Arch Linux users, created and managed by Arch Linux users.

It was created to speed up the inclusion of packages into the community repository, and it has evolved into a massive collection of software in the form of PKGBUILDs, which make it possible to compile packages from source code with makepkg, and then install them with pacman.

To download and install software from AUR, one has to complete the following steps:

  • Download the PKGBUILD from AUR. It’s recommended to manually verify the PKGBUILD to ensure that it doesn’t contain anything malicious.
  • Run the “makepkg” command in the directory with the PKGBUILD to build the package. A package file with the “.pkg.tar.xz” extension will be created.
  • If required dependencies are missing, issue the “makepkg -s” command to install needed dependencies.
  • Run the “makepkg -i” command in the working directory to install the package.
  • Alternatively, simply use the “makepkg -si” command to accomplish both the second and the third step at once.

Note: to build packages from AUR, it’s necessary to have the base-devel group installed from the core repository.

AUR Helpers

Just like there are tools that make working with pacman easier, there are also tools, called AUR helpers, that automate certain tasks for the Arch User Repository. Included among them is aurman, an AUR helper with almost pacman syntax, pakku, a pacman wrapper with AUR support, and trizen, a lightweight wrapper for AUR written in Perl., just to name a few.

Conclusion

The Arch Linux package management is not nearly as complicated as it may initially seem to someone who hasn’t spent any time learning how it works. Its elegant simplicity combined with remarkable versatility make it powerful and easy to grasp.

While it takes just a handful of commands to accomplish everything from package installation to package removal to system updates, more advance tasks naturally require more advance commands and their chains. When in doubt, we highly recommend you consult the Arch Linux wiki to avoid breaking your system.

Also, Arch Linux users have created a number of handy pacman and Arch Linux cheat sheets, such as this one, and it’s a good idea to keep one nearby until you learn the ropes.

About the author

David Morelo

David Morelo is a professional content writer in the technology niche, covering everything from consumer products to emerging technologies and their cross-industry application