Arch Linux

How to Use AUR with Arch Linux

How to Use AUR with Arch Linux
Arch User Repository, also known as AUR, is a major part of the Arch Linux ecosystem. It's a community-driven repository for the Arch Linux system that hosts a number of packages outside the official Arch Linux package database.

Popular AUR projects can eventually get into the official Arch repository! The fact is, a good number of all the new packages added to the Arch Linux official repositories were first AUR packages before becoming official.

How AUR works

AUR is actually a repository of PKGBUILD scripts. It doesn't necessarily hold the source code of the target package. When you're using AUR, you're actually grabbing the PKGBUILD script and building the program for yourself.

PKGBUILD a specialized script for the Arch Linux system that tells the compiler how to build a certain package for the system. The process may include downloading an additional package(s) and source code. The script is also free to have specialized tweaks and fixes for the building process.

So, when you're getting a package from AUR, you're actually grabbing the PKGBUILD script. Your system still needs to execute the script and perform the building process to completely install the package.

Why AUR?

The thing is, AUR is one of the pivotal reasons why Arch Linux is such a popular one. Unlike other Linux ecosystems, you're less susceptible to any permanent security hole in your system. Moreover, AUR packages are easier to install and keep up-to-date, all by yourself.

In the case of AUR, you build the package from source with the help of PKGBUILD. The PKGBUILD script takes care of the entire building process. The maintainer of the package has to create the PKGBUILD, of course. The PKGBUILD system makes the building procedure fluent and hassle-free. Of course, it still holds the potential of installing malicious codes into your system. But instead of adding a complete repo, you just have to worry about the package itself.

Don't worry; the building procedure is never so simple. It doesn't take much time, either. Unless, of course, you're building something heavy like the Linux kernel or Firefox.

Using AUR

Enough chitchat about AUR. It's time to learn how to use AUR.

Using AUR Classic Method

This is the manual and classic way of installing a package from AUR. Everything has to be performed manually, so this path requires more time and patience. Of course, AUR helpers can automate the entire process, but it's said that one shouldn't use any AUR helper if one isn't able to use AUR manually.

Installing a package, Classic Method

Installing a package from AUR is quite different than installing a package with pacman. At first, make sure that your system includes all the necessary tools to perform the building process.

sudo pacman -Syu

sudo pacman -S git base-devel

Once your system is ready, grab the AUR package with Git.

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

Change the active directory.

cd /

Start the building process.

makepkg

Once the building process is complete, there will be a TAR.XZ file in the directory. Install it using pacman.

sudo pacman -U .tar.xz

Note: The installation process can also be done with the previous step.

makepkg -sri

Uninstalling a package, Classic Method

As the installation was performed with pacman, use pacman to uninstall the package right away.

sudo pacman -R

Note: Use the following command

sudo pacman -Rs

Updating a package, Classic Method

The installed AUR packages won't update them automatically. You have to manually update the package by following the previous steps.

Grab the latest PKGBUILD from AUR.

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

Note: If you didn't delete the previously created directory, navigate to it and run the following command. Git will upgrade the directory with the latest file(s) and changes.

git pull

Now, re-run the building and installing process.

makepkg
sudo pacman -U .tar.xz

Or,

makepkg -sri

AUR helper

To make life easier, here come the AUR helpers. AUR helpers can automate a large portion of the processes, saving time and trouble.

According to the official Arch Linux AUR helpers wiki, there are numerous AUR helpers out there. While some of them are officially trusted, all of them are capable of performing all the basic jobs efficiently. In this case, we'll only include a handful AUR helpers that are both trusted and actively maintained.

  • auracle-git
  • aurutils
  • trizen
  • yay
  • pacaur

In this tutorial, we'll only focus on yay as it's one of the most popular ones on AUR. It borrows its designs from a number of other AUR helpers like Yaourt (discontinued), Pacaur and Apacman.

Yay - Yet another Yogurt

Installing yay requires the knowledge of installing an AUR package manually. Let's get yay ready.

At first, grab yay from AUR.

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

Build and install yay.

cd yay/
makepkg -sri

Test the yay installation.

yay

This will update the pacman database along with its own AUR database.

Yay usage

Just like pacman, yay is very simple to use. Yay and pacman share common flags for performing similar actions.

Note: yay shouldn't be run with “sudo” privilege.

Installing a package, With Yay

Use yay to install an AUR package.

yay -S

Searching package(s), with Yay

Just like pacman, use the “-Ss” flag for searching for a certain package on AUR.

yay -Ss

Need specific information about a certain package? Use the “-Si” flag.

yay -Si

Update all software, with Yay

The following command will perform an upgrade on all the packages - both AUR and official.

yay -Syu

List all the packages that require an update.

yay -Pu

Cleaning unwanted dependencies, with Yay

For the building process, sometimes, there needs to be additional dependencies installed. When you uninstall a package, its dependencies are still on your system. You can use yay to perform a cleaning.

yay -Yc

Uninstalling package(s), with Yay

For uninstalling a package, yay uses a similar flag like pacman.

yay -R

To remove with the dependencies, use the following structure.

yay -Rs

Note: You can also use pacman to uninstall the package (along with the dependencies). Learn how to uninstall packages with dependencies using pacman on Arch Linux.

Final thoughts

For being an Arch user, you must learn the usage of AUR. Feel free to experiment your way around AUR and the robust ecosystem of Arch Linux.

Cheers!

Gry Najlepsze dystrybucje Linuksa do gier w 2021 r
Najlepsze dystrybucje Linuksa do gier w 2021 r
System operacyjny Linux przeszedł długą drogę od pierwotnego, prostego, serwerowego wyglądu. Ten system operacyjny znacznie się poprawił w ostatnich l...
Gry Jak przechwytywać i przesyłać strumieniowo sesję gry w systemie Linux
Jak przechwytywać i przesyłać strumieniowo sesję gry w systemie Linux
W przeszłości granie w gry było uważane tylko za hobby, ale z czasem branża gier odnotowała ogromny wzrost pod względem technologii i liczby graczy. P...
Gry Najlepsze gry do grania ze śledzeniem rąk
Najlepsze gry do grania ze śledzeniem rąk
Oculus Quest niedawno wprowadził świetny pomysł śledzenia rąk bez kontrolerów. Przy stale rosnącej liczbie gier i działań, które wspierają zarówno for...