Atlantic.Net Blog

How to Use AUR with Arch Linux

AUR, also called Arch User Repository, is a community-driven repository for Arch-based Linux distributions. It allows users to compile packages from the source and then install them via Pacman. The AUR repository provides a lot of software that’s not tested by Arch’s creators and maintainers, but by its users. Also, AUR packages are easier to install and keep up-to-date all by yourself.

In this post, we will show you how to use AUR with Arch Linux.

Step 1 – Configure Repository

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list if you have not done so already. You can do it by editing the mirrorlist configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.8, United States
Server = http://lug.mtu.edu/archlinux/$repo/os/$arch
Server = http://mirror.nl.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.9, United Kingdom
Server = http://mirror.bytemark.co.uk/archlinux/$repo/os/$arch
## Score: 1.5, United Kingdom
Server = http://mirrors.manchester.m247.com/arch-linux/$repo/os/$arch
Server = http://archlinux.dcc.fc.up.pt/$repo/os/$arch
## Score: 6.6, United States
Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch
## Score: 6.7, United States
Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch
## Score: 6.8, United States
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
## Score: 7.1, India
Server = http://mirror.cse.iitk.ac.in/archlinux/$repo/os/$arch
## Score: 10.1, United States
Server = http://mirrors.xmission.com/archlinux/$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 2 – Create a New User

You can now use the AUR package as a root user, so you will need to create a new user to use the AUR package.

First, create a new user with the following command:

useradd -m user1

Next, set a password for a user with the following command:

passwd user1

Next, edit the sudoers file:

nano /etc/sudoers

Uncomment the following line:

 %wheel ALL=(ALL:ALL) NOPASSWD: ALL

Save and close the file, then add the user to the wheel group:

usermod -aG wheel user1

Step 3 – Install AUR Helper Script

You can use the AUR with the AUR helper tool. AUR helper is a command-line tool that allows you to search and install packages available in the AUR repository.

First, log in as a user1 and install the necessary build tools using the following command:

su - user1
sudo pacman -S --needed base-devel git

You will be asked to choose which you’d like to install.
AUR select package to install
Select “all” option and press the Enter key. You should see the following screen:
AUR proceed with installation

Type Y and press the Enter key to proceed with the installation.

Next, download the YAY tool with the following command:

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

Next, navigate to the downloaded directory and build the package with the following command:

cd yay
makepkg -si

Step 4 – How to Use YAY to Install AUR Package

The basic syntax to use YAY is shown below:

yay -S package-name

For example, to install the unzip command, run the following command:

yay -S unzip

If you want to uninstall the package, run the following command:

yay -Rns unzip

To remove unwanted dependencies, run the following command:

yay -Yc

Step 5 – Install AUR Package Manually

You can also download the packages from the AUR repository, compile, and install them.

Let’s download the Google Chrome package with the following command:

git clone https://aur.archlinux.org/google-chrome.git

Next, navigate to the downloaded package and compile it with the following command:

cd google-chrome
makepkg -si

Conclusion

In this post, we explained how to use AUR in Arch Linux. You can now use AUR to install some additional packages that are not available in the Arch Linux default repository. You can choose one of our dedicated server hosting from Atlantic.Net! to test the AUR.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year