Install and Run Linux GUI Apps on Android with Termux & XServer XSDL

13 min read Step‑by‑step guide to install a Linux distribution in Termux, set up XServer XSDL, and launch GUI apps like GIMP on Android without rooting. October 09, 2026 13:30 How to Install and Run Linux GUI Applications on Android Using Termux and XServer XSDL (No Root)

Before you start – what you need

Getting a Linux graphical environment on Android is possible without rooting, but you have to meet a few prerequisites. Gather them first so the process runs smoothly.

  • Android version 7.0 (Nougat) or newer. The Termux and XServer XSDL packages rely on recent APIs.
  • At least 2 GB of free storage. The Ubuntu base image occupies ~1 GB; additional apps need extra space.
  • Stable Wi‑Fi or mobile data connection for downloading packages (≈500 MB).
  • Device charged to >50 % or connected to a charger. The installation can take 15‑30 minutes of continuous CPU use.
  • Patience for a command‑line workflow. All steps are performed in Termux, which is a terminal emulator.

If you prefer a visual backup of your data, create a regular ADB backup now – the process will not touch your personal files, but a backup is a good safety net.

Step 1 – Install Termux and XServer XSDL

  1. Open the F‑Droid app store (recommended for the latest build) and search for Termux. Install it.

    Why F‑Droid? The Play Store version is often a few releases behind and may miss recent permission changes.

  2. In the same way, install XServer XSDL from the Play Store. It is a lightweight X11 server that renders Linux GUI windows on Android.

    When you first launch XServer XSDL, it will ask for permission to draw over other apps – grant it.

Step 2 – Prepare Termux environment

  1. Open Termux. The first time it runs, it will set up its own directory structure (~/.termux) and ask you to allow storage access. Tap Allow when the permission dialog appears.
  2. Update the package repository and upgrade existing packages:
    pkg update && pkg upgrade -y

    This ensures you have the latest proot and git tools, which are essential for the next steps.

  3. Install the core utilities needed for a Linux distro:
    pkg install proot-distro git wget curl tar -y

Step 3 – Install a Linux distribution with proot-distro

Termux ships with proot-distro, a wrapper that downloads and configures popular Linux roots (Ubuntu, Debian, Alpine, etc.) without root privileges.

  1. List available distributions to confirm Ubuntu is supported:
    proot-distro list
  2. Install Ubuntu 22.04 (the LTS version) into a hidden folder inside Termux:
    proot-distro install ubuntu-22.04

    The download will take a few minutes; you’ll see a progress bar.

  3. Start the Ubuntu session:
    proot-distro login ubuntu-22.04

    You are now inside a regular Ubuntu shell. The prompt changes from ~ $ to something like root@ubuntu:/ #.

Step 4 – Install X11 packages inside Ubuntu

To run graphical applications, you need an X11 server (provided by XServer XSDL) and a few client libraries.

  1. Update Ubuntu’s package lists:
    apt update
  2. Install the minimal X11 utilities and a sample GUI app (GIMP) as a demonstration:
    apt install -y x11-apps gimp

    x11-apps gives you xclock and xeyes for quick testing.

  3. Optional: Install xfce4-terminal if you prefer a lightweight terminal emulator inside the Linux session:
    apt install -y xfce4-terminal

Step 5 – Configure the DISPLAY environment variable

Linux GUI programs need to know where to send their graphical output. XServer XSDL runs on a TCP port that you can reach from the Ubuntu session.

  1. Leave the Ubuntu session running and switch back to Android’s home screen.
  2. Launch XServer XSDL. It will start and display a black screen with a small status bar at the top. Note the IP address shown – usually 127.0.0.1:0 (port 0).

    If the address is different, write it down; you’ll need it in the next step.

  3. Return to Termux, and inside the Ubuntu session, set the DISPLAY variable to point to the XServer instance:
    export DISPLAY=127.0.0.1:0

    For convenience, add the line to ~/.bashrc so it persists across logins:

    echo 'export DISPLAY=127.0.0.1:0' >> ~/.bashrc

  4. Test the connection with a tiny X11 program:
    xeyes

    If XServer XSDL shows a pair of animated eyes following your cursor, the display link works.

Step 6 – Launch a full‑featured GUI app (GIMP)

Now that the X11 bridge is functional, you can start any graphical Linux program that respects the DISPLAY variable.

  1. From the Ubuntu prompt, run:
    gimp

    GIMP’s window will appear inside the XServer XSDL canvas. You can interact with it using your touchscreen or a connected mouse/keyboard.

  2. Resize the XServer window if needed. Swipe from the top edge of the XServer app to reveal its control bar; there you can change the resolution.

    Choosing a resolution that matches your device’s screen (e.g., 1080×2400) gives a near‑native feel.

  3. When you are done, close GIMP from its menu. The XServer window remains open for the next app.

Step 7 – Keep the environment ready for future sessions

Repeating the whole installation each time would be tedious. Follow these shortcuts:

  • Start XServer XSDL first – it stays in the background.
  • In Termux, launch the Ubuntu session with a single command:
    proot-distro login ubuntu-22.04
  • The DISPLAY variable is already set via ~/.bashrc, so any GUI app you start will automatically appear.

For quick access, create a Termux shortcut on your home screen:

termux-open-url "termux://run?command=proot-distro%20login%20ubuntu-22.04"
This opens the Ubuntu shell with one tap.

Troubleshooting common problems

1. No window appears, but the command returns without error

  • Check the DISPLAY value. Inside Ubuntu, run echo $DISPLAY. It must match the address shown by XServer XSDL.
  • Firewall or SELinux restrictions. Some manufacturers (e.g., Samsung) block loopback TCP connections for security. In that case, use the IP address of the Android Wi‑Fi interface (e.g., 192.168.1.101:0) instead of 127.0.0.1. You can find the IP with ip addr show wlan0 from the Termux prompt.

2. XServer XSDL crashes or shows a black screen

  • Make sure the app has permission to draw over other apps (Settings → Apps → XServer XSDL → Permissions).
  • Close any other X11 server apps (e.g., VNC viewers) that might be holding the same port.

3. GIMP runs extremely slowly

  • Reduce the XServer resolution via its control bar. Lower resolutions decrease the amount of pixel data transferred.
  • Install the libgl1-mesa-dri package inside Ubuntu to enable hardware acceleration (if your device’s GPU is exposed to Termux):
    apt install -y libgl1-mesa-dri

4. "Unable to open display" error after a device reboot

  • After a reboot, the loopback address may change. Restart XServer XSDL, note the new address, and re‑export DISPLAY accordingly.

Safety notes and best practices

  • Do not run untrusted binaries. The Ubuntu environment is isolated, but a malicious program could still access your shared storage if you grant it.
  • Keep Termux and XServer XSDL updated via their respective app stores. Security patches are released regularly.
  • Because the Linux filesystem lives inside Termux’s private directory, it is not visible to other apps unless you explicitly bind a storage folder (e.g., termux-setup-storage and then mount /sdcard inside Ubuntu).

What you can do next

Now that you have a working X11 bridge, the possibilities are wide open:

  • Install lightweight IDEs (Geany, VS Code – the server version) for on‑the‑go coding.
  • Run scientific tools like gnuplot or matplotlib for quick visualisations.
  • Explore other desktop environments (LXDE, XFCE) – they run fine on low‑end devices when you keep the resolution modest.

Remember, the core idea is the same: Termux provides a Linux userland, proot-distro gives you a full distribution, and XServer XSDL renders the graphical output. With those three pieces in place, any Linux GUI program becomes accessible on your Android phone or tablet.

User Comments (0)

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