Running a full Linux distro on an Android phone opens the door to a desktop‑class development environment, package managers, and tools that are otherwise unavailable. The combination of Termux (a lightweight terminal emulator) and proot-distro (a user‑space chroot implementation) lets you install Ubuntu without unlocking the bootloader or gaining root privileges.
~/storage area.Why this matters: Termux provides a Linux‑compatible userland (glibc‑like environment) that runs directly on Android’s Dalvik/ART runtime. All subsequent commands are executed inside this sandbox.
pkg update && pkg upgrade -y
pkg install proot-distro wget curl git -y
The pkg command is Termux’s wrapper around apt. Updating ensures you have the latest package lists, while installing proot-distro gives you a simple interface to pull Linux images.
proot-distro ships with several ready‑made images (Ubuntu 20.04, 22.04, Debian, Alpine, etc.). For most users, the latest LTS release provides the best balance of stability and package availability.
# List available distributions
proot-distro list
# Install Ubuntu 22.04 (code name jammy)
proot-distro install ubuntu-22.04
The command downloads a compressed rootfs (~300 MB) and extracts it into ~/.local/share/proot-distro/installed/ubuntu-22.04. This may take a few minutes depending on your network speed.
proot-distro login ubuntu-22.04
After the login command finishes, you are dropped into an Ubuntu shell. The prompt will change from u0_aXXX@localhost to something like root@ubuntu:~#. You are now operating inside a fully functional Ubuntu userland.
apt update
apt upgrade -y
apt install -y build-essential git curl wget nano
These commands behave exactly as they would on a regular Ubuntu installation. All files live inside the Termux private directory, so they cannot affect your Android system.
Running a GUI inside Termux is optional but often desired for editors, browsers, or IDEs. The most straightforward method is to install a lightweight desktop environment (e.g., XFCE) and expose it via a VNC server.
# Inside the Ubuntu shell
apt install -y xfce4 xfce4-goodies tightvncserver
# Set a VNC password (you’ll be prompted)
vncpasswd
The password is stored in ~/.vnc/passwd and is required each time the server starts.
cat > ~/.vnc/xstartup <<'EOF'
#!/data/data/com.termux/files/usr/bin/sh
xrdb $HOME/.Xresources
startxfce4 &
EOF
chmod +x ~/.vnc/xstartup
This script tells the VNC server which desktop environment to launch.
# Start VNC on display :1 (port 5901)
vncserver :1 -geometry 1280x720 -depth 24
After a few seconds you’ll see a line like New 'X' desktop is ubuntu:1. The server is now listening on localhost:5901 inside the Ubuntu environment.
127.0.0.1:5901. Use the password you set earlier.apt install firefox).Because the VNC server runs inside the proot container, the connection never leaves your device – it’s a local loopback.
When you exit the Ubuntu shell (exit or Ctrl+D), the filesystem stays intact. However, the VNC server does not survive a logout. To make it easy to restart, create a small wrapper script in Termux.
# Back in Termux (outside Ubuntu)
cat > ~/start-ubuntu.sh <<'EOF'
#!/data/data/com.termux/files/usr/bin/sh
proot-distro login ubuntu-22.04 --shared-tmp -- bash -c "
# Start VNC if not already running
if ! pgrep -x Xvnc >/dev/null; then
vncserver :1 -geometry 1280x720 -depth 24
fi
exec bash
"
EOF
chmod +x ~/start-ubuntu.sh
Now, a single ~/start-ubuntu.sh call launches Ubuntu, starts VNC if needed, and drops you into a bash prompt.
Termux can access shared storage via the ~/storage symlinks (download, documents, music, etc.). To make these directories visible inside Ubuntu, bind‑mount them when you log in.
# Create a custom login command that binds storage
proot-distro login ubuntu-22.04 --bind /data/data/com.termux/files/home/storage /root/storage
After logging in, you’ll find your Android downloads under /root/storage/downloads. This is handy for compiling source code, moving media, or editing documents with Linux tools.
proot-distro: command not foundproot-distro in Step 2. Run pkg install proot-distro again.PATH variable.wget process to time out.~/.local/share/proot-distro/ubuntu-22.04/rootfs.tar.xz URL. The proot-distro repo lists alternative mirrors on its GitHub page.:1 (5901) is already occupied, possibly by a previous VNC instance. List running VNC processes:
ps -ef | grep Xvnc
kill -9 <PID>
vncserver :2 (port 5902).vncserver :1 -depth 16.-geometry 800x600) to decrease bandwidth.termux-setup-storage inside Termux before launching Ubuntu. This creates the ~/storage symlinks./data/data/com.termux/files/home/storage).vncserver -kill :1).If you ever need to remove the Ubuntu installation, the process is straightforward:
# From Termux (outside any proot session)
proot-distro uninstall ubuntu-22.04
# Optionally delete leftover VNC files
rm -rf ~/.vnc
This frees the space occupied by the rootfs (≈300 MB) and any user data stored inside the container.
apt install python3-pip nodejs npm for scripting.podman (they work inside proot with some limitations).ssh (install openssh-server) to access the Ubuntu shell from another device.termux-api package with Ubuntu scripts to control Android hardware (camera, sensors) from Linux.With Ubuntu running in Termux, your Android phone becomes a portable Linux workstation. All the steps above are reversible, require no rooting, and keep your Android system untouched – the perfect balance of power and safety.









