I have an old Android phone that I'd like to repurpose for a small homelab project. It only needs to connect over SSH, fetch or display data from an API, and run a basic shell script. I've seen guides for installing Debian or Arch on phones, but they seem to run inside Android using a container or specialized app. Would something like that be suitable for this use case, or is it practical to completely replace Android and use the phone like a small Linux computer?
4 Answers
If you want a more phone-oriented Linux system, look at projects such as Droidian, Ubuntu Touch, Mobian, and postmarketOS. Their approaches differ: some reuse Android’s hardware layer, while others aim for a more mainline Linux kernel. In every case, support depends heavily on the exact phone model, so check the project’s supported-device list first.
For this kind of project, Termux is probably the easiest option. It runs on Android while providing a useful Linux command-line environment, so you can install tools, write shell scripts, access APIs, and run an SSH server without replacing the phone’s operating system. Get it from its official source rather than an outdated app store build.
A complete replacement is possible on some phones, but it’s much more involved than installing a desktop Linux distribution on a PC. You generally need an unlocked bootloader, compatible kernels and drivers, and a device-specific installation process. Hardware support can be incomplete, especially for the modem, cameras, graphics, battery management, and Wi-Fi.
You could also investigate rooting the phone if you need deeper access to Android or want services to run with fewer restrictions. However, root is not normally required for the basic SSH-and-script setup, and it introduces extra security and maintenance concerns. A supported Android distribution such as LineageOS may be useful if the phone is compatible and you want a newer or cleaner Android base.

That makes sense. For a simple script and API display, keeping Android and using a Linux environment inside it sounds much less risky.