Android ships with a Linux kernel, but the user‑space is heavily customized. For developers, power users, or anyone who wants a familiar desktop environment on a phone or tablet, installing a full Linux distribution opens up:
apt packages that are not available as Android apps.All of this can be achieved with Termux (a terminal emulator) and proot (a user‑space chroot implementation). The method works on Android 7.0+ and does not require unlocking the bootloader or obtaining root.
Allow).If you have a custom ROM or manufacturer‑specific UI, menu wording may differ slightly, but the steps remain the same.
Termux:API add‑on if you plan to access device sensors later (skip if not needed).Why use F‑Droid? The Play Store version may lag behind and miss recent updates that affect package compatibility.
pkg update && pkg upgrade -y
If you see Failure: Unable to fetch some archives, check your network or retry later.
proot, proot-distro, and wget:
pkg install proot-distro wget -y
proot-distro is a helper script that simplifies downloading and configuring Linux distributions.These packages occupy only a few megabytes but are essential for the sandboxed environment.
Ubuntu LTS (Long Term Support) releases receive security updates for five years, making them the safest choice. We will use Ubuntu 22.04 LTS (Jammy Jellyfish), but you can replace jammy with focal (20.04) if you prefer.
proot-distro list
ubuntu-22.04. If not, you can add a custom URL later.proot-distro install ubuntu-22.04
~/.local/share/proot-distro/ubuntu-22.04.If you encounter Out of space, free up storage or choose a smaller Ubuntu variant (e.g., ubuntu-20.04-minimal).
proot-distro login ubuntu-22.04
root@localhost:~# prompt.Because the environment runs under proot, you have root privileges inside the container, but they do not affect the Android system.
These steps make the Ubuntu instance usable and prevent common pitfalls.
apt update
apt upgrade -y
adduser androiduser
usermod -aG sudo androiduser
Replace androiduser with a name you prefer.
sudo (if you created a user):
passwd androiduser
apt install locales -y
locale-gen en_US.UTF-8
update-locale LANG=en_US.UTF-8
After these commands, you can exit the root shell (exit) and log in as androiduser with su - androiduser.
Depending on your use‑case, you may want a text editor, version control, or a Python environment.
apt install nano git -y
apt install python3 python3-pip -y
openssh-server if you want SSH access from another device:
apt install openssh-server -y
service ssh start
Remember that the SSH daemon will listen only on the loopback interface unless you forward ports via Termux.
Termux provides a shared storage directory at /data/data/com.termux/files/home/storage. To make it visible inside Ubuntu:
termux-setup-storage
This creates ~/storage symlinks to ~/storage/downloads, ~/storage/shared, etc.
mkdir -p /sdcard
mount -t bind /data/data/com.termux/files/home/storage/shared /sdcard
/sdcard inside Ubuntu points to your Android “Files” area. You can read/write files just like on a regular Linux system.
Warning: Changes made in /sdcard affect your Android storage directly. Deleting files here cannot be undone.
Launching Ubuntu each time with proot-distro login incurs a small overhead. You can create a shortcut script to automate the bind‑mount and user login.
cat > start-ubuntu.sh <<'EOF'
#!/data/data/com.termux/files/usr/bin/bash
# Start Ubuntu, mount shared storage, and log in as androiduser
proot-distro login ubuntu-22.04 --shared-tmp --user=root <<'INNER'
mkdir -p /sdcard
mount -t bind /data/data/com.termux/files/home/storage/shared /sdcard
su - androiduser
INNER
EOF
chmod +x start-ubuntu.sh
./start-ubuntu.sh. You will be dropped directly into the non‑root user shell.
This script also ensures the bind‑mount is recreated each session, which is necessary because proot discards mounts on exit.
While the tutorial focuses on command‑line usage, many users enjoy a lightweight X desktop such as xfce4. The steps are optional and increase storage usage.
apt install xfce4 xfce4-terminal dbus-x11 -y
tigervnc-standalone-server):
apt install tigervnc-standalone-server -y
vncpasswd
:1:
vncserver :1 -geometry 1280x720 -depth 24
127.0.0.1:5901. The connection works because Termux forwards the localhost port.
Warning: Running a desktop consumes more RAM and battery. Close the VNC server (vncserver -kill :1) when you are done.
Because the Ubuntu rootfs is just a set of packages, you can keep it up to date using the standard apt workflow.
proot-distro login ubuntu-22.04).apt update && apt full-upgrade -y
apt clean
If you ever need to reinstall the distro (e.g., corrupted filesystem), you can remove it with:
proot-distro remove ubuntu-22.04
Then repeat Step 5.
proot-distro command not foundMake sure you installed the package in Step 3. Run pkg install proot-distro again. If the problem persists, close and reopen Termux to refresh the PATH.
These errors usually stem from network instability. Try the following:
wget and place it in ~/.local/share/proot-distro/ubuntu-22.04 (advanced).mount: permission denied when binding /sdcardProot requires the --shared-tmp flag to allow bind mounts. Ensure your launch script includes it, as shown in Step 10.
Ubuntu’s /var/cache/apt/archives can grow quickly. Clean it with apt clean or increase the storage allocated to Termux (Settings → Storage → Termux). Deleting unused Termux packages with pkg uninstall <pkg> also helps.
Latency often comes from the VNC client’s rendering mode. Switch to “Performance” mode in the Android VNC app, or reduce the display resolution in the vncserver command (e.g., -geometry 1024x600).
/sdcard/Download or any other folder by adding more mount -t bind lines in the launch script.ssh -p 2222 user@127.0.0.1
This works after you start service ssh start inside Ubuntu.
/etc/apt/sources.list inside Ubuntu to add PPAs or third‑party repositories, then run apt update as usual.podman with the --privileged flag inside proot for limited container workloads.If you find yourself regularly needing hardware acceleration, GPU‑intensive workloads, or low‑level networking tools, a dedicated Linux device (e.g., a Raspberry Pi or a cheap x86 mini‑PC) will provide better performance and fewer work‑arounds. The Termux‑Ubuntu combo shines for learning, scripting, and light development on the go.
By following the steps above, you now have a fully functional Ubuntu environment running side‑by‑side with Android, without ever rooting your device. You can install development tools, run server daemons, or simply experiment with Linux commands while on a train or in a coffee shop.
Remember to keep both Termux and the Ubuntu packages updated, back up any important files stored under /sdcard, and be mindful of storage consumption. With this setup, your Android phone becomes a portable Linux workstation—ready for the next coding challenge.









