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.
Once your system is ready, grab the AUR package with Git.
Change the active directory.
Start the building process.
Once the building process is complete, there will be a TAR.XZ file in the directory. Install it using pacman.
Note: The installation process can also be done with the previous step.
Uninstalling a package, Classic Method
As the installation was performed with pacman, use pacman to uninstall the package right away.
Note: Use the following command
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.
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.
Now, re-run the building and installing process.
sudo pacman -U <pkgName>.tar.xz
Or,
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.
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.
Build and install yay.
makepkg -sri
Test the yay installation.
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.
Searching package(s), with Yay
Just like pacman, use the “-Ss” flag for searching for a certain package on AUR.
Need specific information about a certain package? Use the “-Si” flag.
Update all software, with Yay
The following command will perform an upgrade on all the packages – both AUR and official.
List all the packages that require an update.
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.
Uninstalling package(s), with Yay
For uninstalling a package, yay uses a similar flag like pacman.
To remove with the dependencies, use the following structure.
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!