Using AUR on Termux

Termux is a wonderful app that allows users to run a Linux environment on their Android devices. While it comes with many packages that can be installed through apt, there are still some missing from the main repo. Fortunately, there is a project called tur - (termux-user-repository) which adds many of these missing packages.

However, due to Android limitations and the lack of root privileges, even tur may not have all the desired packages. This is where installing ArchLinux in a proot environment on Termux can come in handy.

ArchLinux has a vast user repository called AUR (Arch User Repository). In this article, we will guide you through installing ArchLinux and an AUR helper paru in a proot environment on Termux.

Installing archlinux on proot

  • Before doing anything it's a good idea to upgrade all the existing termux packages. Open termux and type:
pkg upgrade
  • If you run into any issues, try this command first and follow the on-screen instructions:
termux-change-repo
  • Then, we need to install proot-distro for installing our archlinux environment:
pkg install proot-distro
  • Next, we need to install our archlinux distribution in the proot environment:
proot-distro install archlinux

It might take a few minutes, depending on your internet speed.

  • After that's done, we can enter the archlinux environment using proot:
proot-distro login archlinux

This command will start the login shell into archlinux as root.

  • Now, let's first upgrade all the archlinux packages using pacman:
pacman -Syu

Setting up our user

It's not a good idea to run everything as root and if we want to use aur, we need to use the command makepkg which does not work as root.

  • Make sure sudo is already installed:
pacman -S sudo
  • Add a user:
useradd -m <your-user-name>

This will add a new user with its home directory.

  • Set a password for your newly created user:
passwd <your-user-name>

This password will be required when using any command with sudo as a normal user.

  • To give this user access to sudo, We need to add this line <your-user-name> ALL=(ALL:ALL) ALL to the sudoers config file in /etc/sudoers. The recommended method for editing the sudoers file is with visudo command. Type:
EDITOR=nano visudo

and add the following line:

<your-user-name> ALL=(ALL:ALL) ALL

Type Ctrl+O and then Enter to save the file and then Ctrl+X to exit.

  • Now, we need to log in as our newly created user. You can use su <your-user-name> or:
exit

and then:

proot-distro login archlinux --user <your-user-name>

You can also make this long command an alias for future use.

Setting up AUR helper

Now, it's time to install our aur helper, we will be using paru for that, feel free to use any aur helper you like.

sudo pacman -S --needed base-devel

Use your user password, that we have set up when prompted

  • Clone the paru repository:
git clone https://aur.archlinux.org/paru-bin.git

We will use paru-bin instead of paru. It will save us time from compiling paru from the source.

cd paru-bin
makepkg -si
  • Now, we can can use paru to install any AUR package. For, example:
paru -S uwufetch

But I ran into a problem with an error message saying:

paru:error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
  • To fix this error, we need to install a package openssl-1.1:
sudo pacman -S openssl-1.1
  • Now, it should work as intended:
paru -S uwufetch