Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save antonpetrovmain/41714b5abab39e9ef0a1130fb7a27c36 to your computer and use it in GitHub Desktop.
Save antonpetrovmain/41714b5abab39e9ef0a1130fb7a27c36 to your computer and use it in GitHub Desktop.
How to set up Arch Linux in Termux on Android

So, to get started you need to get the base OS installed using the instructions from the official docs .

$ pkg update

$ pkg install bsdtar wget proot tergent tmux openssh

Tmux is a multiplexer that lets you run multiple persistent windows and sessions on a single terminal. I had trouble getting it working in the Arch proot, so a workaround is configuring tmux from your host Termux and then creating a tmux session and starting the chroot from there. For more information on using tmux read this article, and to learn how to customize the appearance and behaviors more try this one as well as looking at the tmux-plugins Github organization for community-built add-ons.

$ termux-setup-storage

$ wget https://raw.githubusercontent.com/SDRausty/termux-arch/master/setupTermuxArch.bash

$ bash setupTermuxArch.bash

This should download and install the Arch system. The install itself will take around 10-30 minutes depending on your device. When the process finishes you'll be in a root shell in your new Arch distro! Of course like any new Linux distro, not everything will work out of the box.

You will want to change the password and maybe even the username of your new Linux user. This can be done with 2 commands.

To add your user:

$ useradd -mG root -s /bin/bash <newuser>

For the password:

$ passwd <newuser>

Once you're user is set up, you can use a crash-tested script I made that should run through and handle any exceptions. If not, it should at least make it easy enough to figure out what went wrong. First download and run it with sudo to avoid repeating your password:

$ sudo pacman -Syyu wget

$ wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=107Fh0l_p0ItVkUufOhP9to-OU_6KYhPW' -O fresharch.sh

$ chmod +x fresharch.sh

$ sudo bash fresharch.sh

If all the instructions were followed correctly yay should install and you'll have a functional Arch Linux with AUR support on your Android device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment