Using the Arch User Repository (AUR)

Published on September 18, 2022 at 6:14 pm by LEW

Introduction

In ARCH Linux there are two types of repositories; Official and User. If you new to ARCH, you will be using the Official repositories. But at some point you may want to branch out to the User repository.

It can sometimes take a bit of time for newer packages to make it into Official repositories. And in some cases, some software may never make it into official repository for a variety of reasons.

This is where the User repositories come in. These are where non official community packages can be found. They can expand the software selection you have access to.

Arch Official Repositories

Linux Distributions (Distro) live and die by their repositories. An official repository, or one of its mirrors, is a storage location where official software packages can be found. A package is basically a software application installer. And official repositories are blessed by the maintainers of a distribution.

These packages are downloaded and installed with a package manager application. The package itself, besides the software application, contains other information like dependencies. The package manger uses this additional information to track and maintain packages on your system, making sure all dependencies are installed, security updates have been implemented, and you are running the latest official available version of applications.

Your package manager will depend on your Distro Family tree. Surprisingly, with the large number of distributions, there are not that many base level package managers. Note I am not talking about software stores, which are a higher level implementation with a GUI.  Anything Debian based (like Ubuntu or Mint) can use package managers like apt or one of its derivatives. Anything Red Hat based (like Fedora) can use a package manager like yum or rpm. And of course, anything Arch based will probably use pacman.

Arch User Repository (AUR)

The concept of the AUR is somewhat unique to Arch Linux. While other distros have multiple repositories beyond the main ones, they tend to not be community maintained. For example, Google maintains a Debian based (apt) repository for application like the Chrome browser or Google Earth. While you can download these programs manually, adding the repository to your package manager will automatically keep thing updated.

In Arch, all these extra items are collected under the AUR heading. In the above example if you search for Arch Linux and Goggle Chrome, you will be directed to Arch Linux User Repository. Here you will find where to download the package, a list of dependencies, as well as comments and remarks from others who have used the package.

Note the AUR listing for Google Chrome is located at archlinux.org. If you were using Debian, as an example, the apt repository would be at Google (http://dl.google.com/linux/chrome/deb/ stable main). This may or may not be something that is important to you, but it does demonstrate who controls the repository.

Basically the AUR contains software that has been packaged by someone in the Arch user community, or a third party and submitted to the AUR. While the AUR may be the only place to find some software, be aware that there are some risks involved with using packages compiled by users. You need to maintain your own due diligence when using the AUR. While there is some package review done, it is not at the same level as software that lives in the official repository.

Some possible problems could be malicious code working its way into an AUR package, an abandoned AUR package, and tracking updates of AUR packages (not handled though the official package manager).

AUR Helpers

You can most certainly manually compile and install AUR packages, it is not as difficult as it would seem on the face of it. You can also install what is known as an AUR helper application. AUR helper applications take on some of the functions of a package manager, as well as simplifying the installation processes.

There are a number of AUR helpers (basically package manager program wrappers that deal with AUR applications) to pick from; pacaur, paru, trizen, yay to name a few. However, they pretty much exclusively live in the AUR repository. This means you will need to do at least one manual AUR install.

In this post I will be picking on yay, as it is one of the popular AUR helpers, with a syntax similar to the main Arch package manager (pacman). The yay application automates searching the AUR repository, getting the AUR package, installing the AUR package, and tracking the AUR package.

Preparing to Install yay

There are a few things we need to do before getting and building the yay package.

Make sure you have sudo access: If you type “sudo” and get unknown command, then you will need to install sudo (as root) and place yourself in the sudo group.

pacman -S sudo
usermod -aG sudo [usermname]

Update current installation: Like always, before doing any installs it is a good idea to update your system. We will use pacman for doing this.

sudo pacman -Syu

The “-S” is for Sync repositories. The “y” is for refreshing the master package list, and the “u” is for upgrade all packages. Since no packages were specified, this will simply sync the package database and upgrade any installed packages to the current official version.

Install Needed Packages: There are two packages you will need, base-devel and git. If you are not into development, you probably do not have them installed.

sudo pacman -S --needed base-devel git

We see the “-S” again for syncing packages. The “–needed” will keep current up to date dependencies form being reinstalled. The “base-devel” package will install things like compilers and header files. The “git” package is a version control system.

Getting yay from the AUR

We will want to clone the yay package. To do this go to archlinux.org and search for yay. From the list , select the package simply called “yay”. Under package details copy the read only git clone URL. You will then use it with git to download t a clone of the latest version, for example.

git clone https://aur.archlinux.org/yay.git

This will download a clone of the repository folder to your home folder. You can use the “-C” option to point to another location if you want (remember to use sudo if it is not a directory you normally have access too).

If you do a listing, and you will see a new folder named yay, with root permissions. You can change this with the chmod command. if you did not use sudo, then you should own the directory and its content.

sudo chown -R [user]:[user] yay

Due Diligence (optional but recommended)

At this point you should change to the yay folder. In the folder you should find a file called “PKBUILD”. Open this in your favorite text editor, and take a look at it. This file contains the build instructions. Depending on how much shell work you do, this may all seem somewhat strange. You just want to make sure there are no obvious bad commands ( like reformatting your hard drive). Most of these files will look similar, and after you have looked at a few, while you may no understand it, you will be able to pick out irregularities that just don’t look right.

Building and Installing

Make sure you are in the yay folder. We are going to run makepkg in the folder. It will execute the instructions in the PKBUILD file.

makepkg -si

The -s option will make sure all dependencies are installed using pacman. The -i option will run the installer after the build is complete.

Note, because we may be using pacman or running the installer, at some point during this process you will be asked for your sudo password.

Once the installer is done, the binaries that were just built should be installed on your system. At this point you should be finished with the yay folder, and it can be deleted if you desire.

Using yay.

The first thing you should do is test yay. Use the following command to do that

yay --version

Searching for a package from the AUR with yay is easy.

yay [package name]

To install a package use the following command.

yay -S [package name]

To remove packages use the following command.

yay -R [package name]

To upgrade all AUR packages use the following command.

yay -Sua

Conclusion

With yay installed, your access to the AUR should be fairly smooth. My recommendation, however; if a package is available from the official source, use it unless you have a good reason not to. For example, if you must have a new feature and it is not available in the official package.

Add New Comment

Your email address will not be published. Required fields are marked *