Install and Run a Full Linux Distribution on Android Using Termux

16 min read Step‑by‑step guide to install Termux, set up proot‑distro, and run Ubuntu (or other Linux) on Android without rooting, with tips for storage and GUI. September 28, 2026 11:00 How to Install and Run a Full Linux Distribution on Android Using Termux and proot-distro

Before you start

Running a Linux distro inside Termux does not require root, but you do need a device that can install apps from unknown sources and has at least 2 GB of free storage for a comfortable Ubuntu installation. A stable Wi‑Fi connection is recommended because the first setup downloads several hundred megabytes.

  • Android version: 8.0 (Oreo) or newer – older versions lack the necessary SELinux policies.
  • Storage: Minimum 2 GB free on internal storage; external SD cards can be used later for data.
  • Battery: Keep the device plugged in during the initial download to avoid interruptions.
  • Termux source: The official Play Store build is no longer updated; use the F‑Droid version for the latest packages.
If you already have Termux installed from an older Play Store package, uninstall it first and reinstall from F‑Droid to avoid compatibility problems.

Step 1: Install Termux

  1. Open your browser and go to the Termux page on F‑Droid.
  2. Tap Download APK, then install the file. You may need to enable Settings > Security > Install unknown apps for the browser you used.
  3. Launch Termux. The first run will set up the basic environment and ask you to allow storage access.
  4. Grant storage permission by tapping Allow when prompted, or run termux-setup-storage later.

After the initial setup you will see a clean command line prompt like ~ $. This is your Linux‑compatible shell.

Step 2: Update Termux packages

  1. Update the package repository:
    pkg update
  2. Upgrade existing packages to the latest versions:
    pkg upgrade -y
  3. Install a few essential tools that will be used later:
    pkg install proot-distro wget curl git -y

Running pkg upgrade ensures the proot-distro script works with the current Termux runtime.

Step 3: Install proot-distro

  1. Install the helper script that simplifies distro management:
    pkg install proot-distro -y
  2. Verify the installation:
    proot-distro --help
    You should see a list of commands such as install, login, and list.

proot-distro uses proot to emulate a chroot environment, meaning the Linux distro runs in user space without needing root privileges.

Step 4: Choose and install a Linux distribution

  1. List the available images:
    proot-distro list
    Typical entries include ubuntu, debian, alpine, and archlinux.
  2. For a full‑featured desktop experience we recommend Ubuntu 22.04 LTS. Install it with:
    proot-distro install ubuntu-22.04
  3. The script will download a compressed rootfs (~300 MB) and extract it under ~/.local/share/proot-distro/installed/ubuntu-22.04. This may take 5‑10 minutes depending on your connection.

When the command finishes you will see a short success message. The distro is now ready but not yet running.

Step 5: Launch the Linux environment

  1. Enter the distro with:
    proot-distro login ubuntu-22.04
  2. You are now inside Ubuntu. The prompt will change to something like root@localhost:~#.
  3. First‑time login runs a minimal setup. Create a regular user for daily work:
    adduser androiduser
    Follow the prompts – you can leave the GECOS fields blank.
  4. Give the new user sudo rights (optional but convenient):
    usermod -aG sudo androiduser
  5. Switch to the new user:
    su - androiduser

From now on you can treat the session exactly like a regular Ubuntu terminal.

Step 6: Access Android’s shared storage from Linux

Termux maps the shared /sdcard directory into the Linux rootfs, allowing you to read and write files that are visible to other Android apps.

  1. Inside the distro, navigate to the mount point:
    cd /sdcard
  2. List your Android downloads:
    ls -l
  3. If you get a permission error, run termux-setup-storage from the original Termux session (outside the distro) and try again.

Note that the Linux user sees the Android file system with Linux permissions, but the underlying Android SELinux policy still governs actual access. Avoid changing ownership or permissions of files in /sdcard – it can break other apps.

Step 7: Install additional Linux packages

Ubuntu’s package manager apt works out of the box. First update the package index, then install what you need.

  1. Update the index:
    sudo apt update
  2. Install common development tools:
    sudo apt install build-essential git vim python3-pip -y
  3. Verify the installation, e.g.:
    python3 --version

All installed binaries reside inside the distro’s rootfs, isolated from the Android system. You can safely experiment without affecting the host.

Step 8: Optional – Set up a graphical desktop with VNC

If you need a GUI (e.g., for graphical editors, browsers, or teaching), you can run a lightweight desktop environment and view it through a VNC client on Android.

  1. Install the X‑window server and a desktop environment (XFCE is a good balance):
    sudo apt install xfce4 xfce4-terminal dbus-x11 -y
  2. Install a VNC server:
    sudo apt install tigervnc-standalone-server -y
  3. Create a VNC password (you will be prompted):
    vncpasswd
  4. Start the VNC server on display :1 with a resolution of 1280×720:
    vncserver :1 -geometry 1280x720 -depth 24
  5. Switch back to the original Termux session (press Ctrl + D or type exit twice) and install a VNC viewer from the Play Store (e.g., VNC Viewer by RealVNC).
  6. Open the VNC viewer, connect to 127.0.0.1:5901. You should see the XFCE desktop.
  7. When you are done, stop the VNC server from inside the distro:
    vncserver -kill :1

Running a desktop consumes more RAM and CPU, so keep an eye on the device’s temperature. For short sessions it works well, but for prolonged use consider a dedicated tablet or a low‑power SBC.

Step 9: Create shortcuts for quick start/stop

Typing the full proot-distro login … command each time can be tedious. You can add simple shell aliases or wrapper scripts.

  1. Open the Termux home directory’s .bashrc (or .zshrc if you use Zsh):
    nano ~/.bashrc
  2. Add the following lines at the end:
    # Shortcut to launch Ubuntu
    alias ubuntu='proot-distro login ubuntu-22.04'
    # Shortcut to stop all proot processes
    alias ubuntu-stop='pkill -f proot-distro'
  3. Save and exit (Ctrl+X → Y → Enter).
  4. Reload the shell:
    source ~/.bashrc
  5. Now you can start Ubuntu with a single ubuntu command and stop it with ubuntu-stop.

Step 10: Updating the Linux distribution

Because the distro lives in a regular file hierarchy, you update it exactly as you would on a native installation.

  1. Enter the distro (if not already logged in):
    proot-distro login ubuntu-22.04
  2. Run the usual upgrade commands:
    sudo apt update && sudo apt full-upgrade -y
  3. Optionally clean up old packages:
    sudo apt autoremove -y && sudo apt clean

The rootfs stays the same; only the package contents change, so you do not need to reinstall the whole image.

Troubleshooting common issues

1. “proot-distro: command not found”

This usually means the proot-distro package was not installed correctly. Re‑run:

pkg install proot-distro -y

and ensure ~/.local/bin is in your $PATH. You can add it to .bashrc if necessary:

export PATH=$HOME/.local/bin:$PATH

2. “No space left on device” during download

Check available storage with df -h in Termux. If the internal partition is full, clear unused apps or move the distro to external storage:

  1. Create a directory on the SD card, e.g. /sdcard/termux-distros.
  2. Tell proot-distro to use it:
    mkdir -p $HOME/.local/share/proot-distro/installed && ln -s /sdcard/termux-distros $HOME/.local/share/proot-distro/installed

3. “Failed to bind mount /dev/null” or similar SELinux errors

Some manufacturers (e.g., Samsung) apply stricter SELinux policies that block certain proot operations. The workaround is to enable the “Allow access to external storage” option in Termux settings, then restart Termux. If the problem persists, you may need to install the termux-exec package:

pkg install termux-exec

4. Network inside the distro is unreachable

By default the distro shares the host’s network stack, but a mis‑configured proxy can break it. Inside Ubuntu run:

ping -c 3 8.8.8.8

If ping works but DNS fails, edit /etc/resolv.conf to include a public DNS server:

echo "nameserver 1.1.1.1" | sudo tee /etc/resolv.conf

5. VNC shows a black screen

Make sure the X‑session is started with the correct display. After installing XFCE, create a startup script:

echo "startxfce4" > ~/.vnc/xstartup
chmod +x ~/.vnc/xstartup
Then restart the VNC server.

Safety and performance notes

  • Data safety: The Linux rootfs lives in a regular directory under ~/.local/share. Back up this folder (e.g., via tar -czf ubuntu-backup.tar.gz ~/.local/share/proot-distro/installed/ubuntu-22.04) if you plan to wipe the device.
  • Battery impact: Running a full distro, especially with a GUI, can drain the battery quickly. Disable the VNC server when not in use and consider enabling Doze mode for background processes.
  • Security: Anything you run inside the distro has the same network privileges as the Android user. Avoid running untrusted binaries that listen on public ports unless you understand the exposure.
  • Compatibility: Some ARM64‑only packages may not be available for the device’s CPU architecture. Use dpkg --print-architecture inside Ubuntu to verify you are pulling the correct binaries.

With these precautions in place, you now have a fully functional Linux environment on your Android phone – ready for coding, server testing, or just satisfying curiosity.

User Comments (0)

Add Comment
We'll never share your email with anyone else.