Running a full Linux desktop on an Android phone used to require a rooted device or a custom ROM. Today the Termux app together with proot‑distro and a VNC server makes it possible to launch Ubuntu (or other Debian‑based distros) entirely in user space. This tutorial walks you through the entire process – from preparing your phone to connecting a VNC client – and explains why each step matters.
# prompt, you are in the Linux shell; a $ prompt indicates a normal user shell.termux-setup-storageWhy this matters: proot‑distro creates a Linux root filesystem inside your internal storage. Without the permission, any attempt to write files outside Termux’s private directory fails.
pkg update && pkg upgrade -yproot and openssl binaries, which improves compatibility.pkg install proot-distro wget curl tar -yproot-distro is a wrapper that fetches a rootfs tarball, extracts it, and runs it inside a proot container. It works on all Android devices without root.
proot-distro listubuntu-20.04 (or a newer release) among the options.proot-distro install ubuntu-20.04~/../usr/var/lib/proot-distro/installed/ubuntu-20.04, and sets up a basic environment.proot-distro login ubuntu-20.04root@localhost:~#. Type exit to return to Termux.install command – it will resume from the last good chunk.Running a full GNOME or KDE stack on a phone is impractical. XFCE provides a good balance of functionality and resource usage.
proot-distro login ubuntu-20.04apt updateapt install xfce4 xfce4-terminal dbus-x11 -yapt install tightvncserver -ytightvncserver :1New 'X' desktop is ubuntu:1. Stop the server for now:
tightvncserver -kill :1~/.vnc/xstartup:
#!/bin/sh
xrdb $HOME/.Xresources
startxfce4 &
chmod +x ~/.vnc/xstartupexitWhy we use :1: The :1 display number tells the VNC server to listen on TCP port 5901. This is the default port most VNC clients expect.
Typing the whole login and VNC start sequence each time is cumbersome. We’ll add a small wrapper script in Termux.
~/start-ubuntu-vnc.sh:
nano ~/start-ubuntu-vnc.sh#!/data/data/com.termux/files/usr/bin/bash
# Launch Ubuntu in proot and start VNC on display :1
proot-distro login ubuntu-20.04 --shared-tmp -- bash -c "
export DISPLAY=:1
tightvncserver :1 -geometry 1280x720 -depth 24
"chmod +x ~/start-ubuntu-vnc.sh~/start-ubuntu-vnc.shSeveral free VNC viewers are available; we’ll use VNC Viewer by RealVNC because of its clean UI.
127.0.0.1:5901 (or localhost:5901) and give it a name like “Ubuntu Desktop”.Tip: Rotate your device to landscape for a more desktop‑like aspect ratio. The VNC app supports pinch‑to‑zoom, which helps on smaller screens.
Now that the desktop is running, you can install any Debian package you need. Common additions include:
sudo apt install git vim curl – development tools.sudo apt install python3-pip – Python environment.sudo apt install libreoffice – office suite (requires more RAM).Remember to use sudo inside the VNC session; the default Ubuntu user in proot-distro is root, so you can omit sudo if you prefer.
Because the VNC server runs inside the Termux process, you control it from Termux.
start-ubuntu-vnc.sh, press Ctrl+C. This kills the VNC server and returns you to the Termux prompt.~/start-ubuntu-vnc.sh again.pkill -f tightvncserver-geometry flag in the launch script determines the virtual screen size. Lower it (e.g., 800x600) if the UI feels sluggish.fallocate -l 512M /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
/swapfile none swap sw 0 0 to /etc/fstab if you want it to persist across reboots.proot-distro install ubuntu-20.04 --path /sdcard/ubuntu--path /sdcard/ubuntu to the login command).xstartup file is executable and contains startxfce4 &.ps | grep Xtightvnc inside the Ubuntu shell.Cannot open display :1, the DISPLAY variable may not be exported. Edit the launch script to add export DISPLAY=:1 before starting tightvncserver.This means the proot-distro package wasn’t installed. Run pkg install proot-distro again and restart Termux.
Sometimes the Ubuntu rootfs is corrupted. Remove the installation and reinstall:
proot-distro remove ubuntu-20.04 && proot-distro install ubuntu-20.04netstat -tlnp | grep 5901 inside Ubuntu.127.0.0.1:5901 (not the device’s external IP) in the VNC app.localhost instead of 127.0.0.1, or install a tiny port‑forwarding app like Port Forwarder Lite to map 5901 to 127.0.0.1.By following this guide you now have a functional Ubuntu 20.04 desktop running entirely in user space on your Android phone. You can compile code, run Python scripts, edit documents, or experiment with Linux tools without rooting or flashing your device. Because everything lives inside Termux’s sandbox, you can delete the installation at any time by running proot-distro remove ubuntu-20.04 – leaving your Android system untouched.
Enjoy the flexibility of a Linux desktop on the go, and feel free to explore other distributions (Debian, Alpine) using the same workflow. The same steps apply; just replace ubuntu-20.04 with the desired distro name in the proot-distro commands.









