Easy Way to Install Ubuntu on Android Using Termux
Introduction
Ubuntu is a beginner-friendly Linux distribution that is easy to use and ideal for getting started. In this guide, you’ll learn how to install Ubuntu on Android using Termux without root access. A graphical desktop environment will also be installed to provide a full Ubuntu desktop experience.
Prerequisites
- Termux: Installed on your Android device
- VNC Viewer: Any VNC Viewer app from the Google Play Store
Installation of Ubuntu
Step 1: Update Termux and Install proot-distro
pkg update -y ; pkg install proot-distro
Step 2: Install Ubuntu
proot-distro install ubuntu
Step 3: Login to Ubuntu and Update Repositories
proot-distro login ubuntu
apt update ; apt install sudo nano
Step 4: Set Up a Local User
adduser <username>
echo "<username> ALL=(ALL:ALL) ALL" >> /etc/sudoers
Create a password for the new user when prompted.
Step 5: Switch to the New User
su <username>
Installing GUI (Xfce Desktop)
Step 1: Install Xfce Desktop and Terminal
sudo apt install xfce4 xfce4-terminal xfce4-whiskermenu-plugin
Step 2: Install Themes, Icons, Plank, and VNC Server
sudo apt install yaru-theme-gtk yaru-theme-icon plank dbus-x11 tigervnc-standalone-server
Step 3: Create VNC Server Shortcuts
echo "vncserver -geometry 1280x720 -xstartup /usr/bin/startxfce4" >> /usr/local/bin/vncstart
echo "vncserver -kill :1" >> /usr/local/bin/vncstop
chmod +x /usr/local/bin/vncst*
You can adjust the -geometry value to match your preferred screen resolution.
Step 4: Start VNC Server and Connect
vncstart
Open VNC Viewer, create a new connection using localhost:1, and enter your VNC password
to access the Ubuntu desktop.
Optional: Enable Sound in Ubuntu
Step 1: Install PulseAudio in Termux
pkg install pulseaudio
Step 2: Configure PulseAudio
nano ~/.bashrc
Add the following configuration:
pulseaudio --start \
--load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" \
--exit-idle-time=-1
Step 3: Apply Changes and Configure Ubuntu
bash
echo "export PULSE_SERVER=127.0.0.1" >> ~/.bashrc
bash
Additional Tips
Stop the VNC Server
vncstop
Create a Shortcut to Start Ubuntu
echo "proot-distro login --user <username> ubuntu" >> $PREFIX/bin/ubuntu
chmod +x $PREFIX/bin/ubuntu
You’re all set! Enjoy running Ubuntu with a desktop environment on your Android device.