How to work with AUR
Probably when you started using an Arch Linux (or Arch-based system like Manjaro, EndeavourOS, ArcoLinux, etc.) you were seen a lot of mysterious words in manuals and guides like AUR. Maybe you already tried to work with it, but you felt defeat. So let’s explain it step-by-step.
Firstly. What the heck is AUR?
AUR it’s an abbreviation of Arch User Repository. Probably you already know a utility called pacman. That is a core package of your distribution — your package manager. Maybe you use some graphical utilities like pamac, if you prefer a more «intuitive» and «easiest» way to perform your system maintenance, that does not matter. It's still just a GUI for pacman. That’s pacman uses repositories provided by:
/etc/pacman.conf
I will make another note which would explain about pacman (Of course If you don’t know, stay tune).
But these repos contain only the most popular software and if you want to install something like DaVinci Resolve you should use a non-official one.
And how you can think from this abbreviation — AUR is another repository. The core feature of this repository is literally everyone can host a PKGBUILD file, which is necessary to ABS — Arch Build System. That’s means in AUR you can find almost all software you want to use, but also that’s mean nobody will care about the security of these packages, so be careful and do not use AUR if privacy is your main target.
Okay, but how I can use it?
The official way is manual download and compile everything you want from this repository. But we will do it only one time because it is not secure. You should keep all your system up-to-date due to software vulnerabilities. The easiest way to do that is to install an AUR helper. In my opinion, the most powerful and preferable one is yay.
At first, open your terminal and change your current directory to a temporary one. Just use the command below:
cd /tmp/
Now make sure that you have a git installed. If it doesn’t, or you are not sure, use the command below:
sudo pacman -S git
Make sure that you use a capital S because all commands on Linux are case-sensitive.
Now let’s clone a yay repository. You probably want to use precompiled version, if you don’t — just use «yay» instead of «yay-bin».
git clone https://aur.archlinux.org/yay-bin.git
After you download a PKGBUILD file open a downloaded directory. For this, use a command listed below. If you cloned a sourced one, just open a yay directory.
cd yay-bin
Now run this command to install yay:
makepkg -si
And after that, you probably will get an installed application.
How to use it?
yay have the same arguments as pacman. So if you know how to use pacman — you already know how to use yay. But yay is a more powerful tool. It can replace you pacman. yay can work not only with AUR it also works with main official repos.
Some usage examples:
How to update your database:
yay -Sy
*Little note, you probably should use a «yay -Syy» to avoid some issues.
How to update your system (pacman and AUR packages):
yay -Syu
*Little note, you probably should use a «yay -Syyu» to avoid some issues.
How to find a package:
yay -Ss packagename
How to install a package:
yay -S packagename
How to delete a package without dependencies:
yay -R packagename
How to remove a package with dependencies:
yay -Rs packagename
How to list explicitly installed packages:
yay -Qe
How to list all packages no longer required as dependencies (orphans):
yay -Qdt
How to delete all orphans with their dependencies:
yay -Qtdq | yay -Rns -
Some usage tricks
You probably don’t want to see «Show difference», «Make a clean build», «Edit a PKGBUILD», «Remove make dependencies» entries every time when you're starting a system upgrade or installing a new package.
There’s a little tweak that disables these annoying functions:
yay --nodiffmenu --nocleanmenu --noeditmenu --noremovemake --save
Troubleshooting
If you got an error like this one:
One or more files did not pass the validity check!
You should use that command:
yay -S --mflags --skipinteg packagename
If you got an error containing PGP/GPG or keyring while installing the package, just do this command (like always with double dashes):
sudo pacman-key --populate archlinux
and
yay -S archlinux-keyring
The problem should have been fixed.