Skip to content

Instantly share code, notes, and snippets.

@AlipioAfonso
Forked from RebelLion420/TermuxArchSetup2024.md
Created October 24, 2024 19:56
Show Gist options
  • Select an option

  • Save AlipioAfonso/a939ce7f69191d38062a69759d959d9d to your computer and use it in GitHub Desktop.

Select an option

Save AlipioAfonso/a939ce7f69191d38062a69759d959d9d to your computer and use it in GitHub Desktop.
How to set up Arch Linux in Termux on Android

NOTICE: This will take up about 3 GB of space on your device, before syncing any repos or projects.

Install Termux from the Play Store and launch it

Once it finishes unpacking:

pkg update

pkg upgrade -y

pkg install wget -y

Now that all the required packages are installed let's set up the Arch Linux environment.

wget -nv https://raw.githubusercontent.com/RebelLion420/build_tools/refs/heads/master/termux-arch-setup/termux_arch_setup.sh

bash termux_arch_setup.sh

You may get some errors during the install, but it is safe to ignore as long as it shows the green message block at the end. You are now ready to boot up Arch Linux, but it still needs to be configured.

startarch

You should load into the root shell by default. We first have to set up the package manager to function properly and then add our user account.

pacman-key --init

pacman-key --populate

pacman -Sy --noconfirm archlinuxarm-keyring glibc-locales

pacman-key --populate archlinuxarm

addauser <newuser>

Let the command install and setup sudo for your new user, and when it's done set your password:

passwd <newuser>

exit

Now we can login to our user account and finish the environment setup. Our new way of booting up our Linux environment is by using:

startarch login <newuser>

Next we install the required packages inside the Linux environment and download the scripts that will handle the rest

sudo pacman -Syu --needed --noconfirm base-devel wget git

This will take a long time to upgrade. You may have to keep your phone awake while it runs, acquiring a wakelock did not seem to work on my device.

cd ~ && git clone https://github.com/RebelLion420/build_tools.git tools

cd ~/tools/termux-arch-setup

sudo bash termux_build_env.sh

Enter your shell username when prompted and let the script process. After it finishes you should have your desired repos synced and ready to compile. I only used this environment to build Android kernels on my device, I cannot offer any advice for building ROMs on an Android device.

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