How to Use AUR with Arch Linux

29/12/2020
Chưa phân loại
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/<pkgName>.git

Change the active directory.

cd <pkgName>/

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 <package_name>.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 <package_name>

Note: Use the following command

sudo pacman -Rs <package_name>

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/<pkgName>.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 <pkgName>.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.

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 <pkgName>

Searching package(s), with Yay

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

yay -Ss <pkgName>

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

yay -Si <pkgName>

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 <pkgName>

To remove with the dependencies, use the following structure.

yay -Rs <pkgName>

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!

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Best Self-Hosted Search Engines  

Does your boss know that you’re looking for another job? Have you told your significant other about the inability to...
29/12/2020

How to Install Zabbix on Raspberry Pi 3

Zabbix is an open source software for monitoring servers, cloud services, virtual machines and many more. In this article,...
29/12/2020

Cách sử dụng Fail2ban để bảo mật máy chủ CentOS

Mục lục Giới thiệu Cài đặt và cấu hình Giám sát cấu hình firewall và nhật ký Fail2ban Giám...
30/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Hướng Dẫn Chọn Dịch Vụ Thuê Địa Chỉ IPv4
10/03/2025

Reliable IPv4 and IPv6 Subnet Rental Services: The Perfect Solution for Global Businesses
23/12/2024

Tìm Hiểu Về Thuê Proxy US – Lợi Ích và Cách Sử Dụng Hiệu Quả
11/12/2024

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn
03/06/2024

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh
03/06/2024