How to Install Ubuntu in Termux Using GitHub — Complete Step-by-Step Guide for Android (2026)
- Introduction — Why Run Ubuntu on Android?
- What Is Termux and How Does It Work?
- What Is Ubuntu and Why Use It in Termux?
- How Ubuntu Actually Runs Inside Termux
- Requirements Before You Begin
- Step 1 — Update and Upgrade Termux Packages
- Step 2 — Install Git
- Step 3 — Clone the Ubuntu Script from GitHub
- Step 4 — Navigate to the Cloned Directory
- Step 5 — Grant Execute Permission to the Script
- Step 6 — Run the Installation Script
- Step 7 — Launch Ubuntu
- Step 8 — Verify the Installation
- Step 9 — Update Ubuntu and Install Packages
- Step 10 — Exit and Restart Ubuntu
- Useful Ubuntu Commands Reference
- What You Can Do with Ubuntu in Termux
- Troubleshooting Common Errors
- FAQ
- Conclusion
// 01 — Introduction: Why Run Ubuntu on Android?
Imagine carrying a fully functional Linux computer in your pocket. That is exactly what becomes possible when you install Ubuntu inside Termux on your Android device. For students, developers, security researchers, and Linux enthusiasts, this combination opens up a world of possibilities that most people do not realise is available on a simple Android smartphone.
Running Ubuntu inside Termux is not a trick or a hack — it is a legitimate, well-supported approach to creating a complete Linux environment on Android without any root access. You can write and compile code, manage remote servers via SSH, run Python scripts, host local web applications, practice Linux system administration, and explore the full depth of what a Unix-like operating system offers — all from your phone.
In this guide, we walk through absolutely every step of the process in clear, simple language. Whether you have never opened a terminal before or you already have some experience with Linux commands, this tutorial is designed to get you from zero to a fully working Ubuntu shell inside Termux without any confusion. We cover the why, the how, the what-if-something-goes-wrong, and everything in between.
This is not a rushed tutorial. By the time you finish, you will understand not just how to install Ubuntu in Termux but also why each step matters, what each command actually does, and how to make the most of your new Linux environment. Let's begin.
// 02 — What Is Termux and How Does It Work?
Termux is a free and open-source terminal emulator application for Android. What makes it unique compared to other terminal apps is that it does not just simulate a terminal — it provides a real, working Linux-compatible environment with its own package manager, file system, and a growing library of software packages you can install and use.
When you open Termux, you are presented with a command-line interface very similar to what you would see on a Linux or macOS computer. You can type commands, install software, write scripts, and do virtually anything you would expect from a real Linux terminal. Termux runs on top of Android without requiring root access, which means you do not need to modify your device at a system level to use it.
Termux ships with its own package repository and package manager called pkg — a simplified wrapper around APT, the same package manager used in Debian and Ubuntu Linux. Through this system you can install tools like Python, Node.js, Git, PHP, Nmap, Vim, and hundreds of other programs.
One of the most powerful features of Termux is its ability to run PRoot — a userspace implementation of the chroot system call. PRoot allows Termux to run a full Linux distribution inside a contained environment without needing actual system root access. This is the exact technology that makes installing Ubuntu in Termux possible and why this approach works so reliably.
// 03 — What Is Ubuntu and Why Use It in Termux?
Ubuntu is one of the world's most popular Linux distributions. Developed and maintained by Canonical, Ubuntu is built on top of Debian Linux and is known for being beginner-friendly while remaining powerful enough for professional use. It is widely used in servers, cloud computing, software development, data science, and general desktop computing.
When you install Ubuntu inside Termux, you gain access to Ubuntu's massive package repository. The apt package manager in Ubuntu gives you access to tens of thousands of software packages — far more than what is natively available in Termux alone. This includes development tools, network utilities, text editors, web servers, databases, scripting environments, and much more.
| Reason | Explanation |
|---|---|
| Larger Package Library | Ubuntu's APT repository has vastly more software than Termux's native repo |
| Familiar Environment | Developers already familiar with Ubuntu can work comfortably |
| Standard Linux Paths | Uses standard paths like /usr/bin and /etc that many scripts expect |
| Better Compatibility | Software built for Debian/Ubuntu that won't compile in Termux works here |
| Learning Linux Admin | Perfect sandbox for learning Ubuntu server administration on the go |
| Full Dev Stacks | Run complete stacks like LAMP, Python Flask, Django, Node.js |
// 04 — How Ubuntu Actually Runs Inside Termux
When we say "install Ubuntu in Termux," what we really mean is setting up a Ubuntu root filesystem inside Termux using a technique called PRoot. PRoot is a userspace implementation of the chroot system call — a Linux mechanism that changes the root directory for a process and all its children. In simpler terms, it tricks a program into thinking it is running at the root of a completely different file system.
The GitHub script used in this tutorial automates several things. First, it downloads a minimal Ubuntu root filesystem tarball — a compressed archive of a basic Ubuntu installation. Then it extracts this archive into a directory inside your Termux home folder. Finally, it configures PRoot to run within that Ubuntu directory, creating a seamless experience where your commands run inside the Ubuntu environment.
The result is not a full virtual machine. It does not have its own kernel — it shares the Android Linux kernel already running on your device. This is actually a feature, not a limitation. Startup is instant, resource usage is low, and there is no virtualization overhead. The experience feels like a genuine Ubuntu shell because for all practical purposes, it is one.
Network access is shared with Android, so your Ubuntu environment has internet access like any other app on your phone. Storage is also shared with Termux, meaning you can freely copy files between your Termux home directory and the Ubuntu environment.
// 05 — Requirements Before You Begin
Before running a single command, make sure you have everything ready. A little preparation now saves a lot of frustration later.
| Requirement | Details |
|---|---|
| Android Version | Android 7.0 (Nougat) or higher |
| RAM | At least 2 GB — 3 GB or more recommended |
| Free Storage | At least 2 GB free (5 GB recommended) |
| Termux Source | F-Droid ONLY — never the Google Play Store |
| Internet | WiFi strongly recommended — stable connection required |
| Root Access | Not required — works on any stock Android |
| Battery | Keep phone charged or plugged in during installation |
The most important item is the Termux source. The Play Store version of Termux stopped receiving updates in 2020. Its package repositories are broken and cause errors when installing anything modern. Always install from F-Droid.
Storage is the other critical factor. The base Ubuntu installation takes around 500 MB to 1 GB. Once you start adding packages, the size grows quickly. Having 5 GB free gives you comfortable working room.
// 06 — Step 1: Update and Upgrade Termux Packages
The very first thing to do every time you work in Termux is update and upgrade your packages. This ensures you have the latest versions of all software and that your package lists are current. Running outdated packages causes conflicts and errors when installing new tools. Do not skip this step.
pkg update && pkg upgrade -y
What this does: pkg update refreshes the list of available packages from Termux's servers — it checks what is new but does not install anything yet. pkg upgrade -y then downloads and installs all newer versions of already-installed packages. The -y flag answers yes automatically to all confirmation prompts.
This takes a few minutes depending on your connection speed and how many packages need updating. You will see a lot of text scrolling by — that is completely normal. Do not interrupt it. If it asks whether to replace a configuration file, press Enter to keep the default. When the command prompt returns, the update is complete.
pkg update && pkg upgrade -y every time you open Termux before installing new software. It takes two minutes and prevents most errors before they happen.// 07 — Step 2: Install Git
Git is a distributed version control system and one of the most widely used tools in software development. We need Git specifically to clone — download — the Ubuntu installation script from GitHub. Without Git there is no way to get the script, so this step is essential.
pkg install git -y
This downloads and installs Git. The installation is fast — Git is a small package and installs within a minute or two. Once done, verify it worked:
git --version
git version 2.43.0
If you see a version number, Git is installed and working. If you see an error, run the pkg update command from Step 1 again and then re-run the Git installation.
// 08 — Step 3: Clone the Ubuntu Script from GitHub
Now download the Ubuntu installation script from GitHub using Git. This script was created by HYDRA TERMUX specifically to automate the full process — downloading the Ubuntu filesystem, configuring PRoot, and creating the launch script for you. Everything is handled automatically once you run it.
git clone https://github.com/HYDRA-TERMUX/ubuntu-termux
When you run git clone followed by a URL, Git downloads the entire repository and creates a local copy in your current directory. In Termux, your current directory when you first open the app is your home directory at /data/data/com.termux/files/home/. After cloning, a new folder called ubuntu-termux will appear there.
You will see output like this during cloning:
Cloning into 'ubuntu-termux'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (32/32), done.
Receiving objects: 100% (45/45), 18.45 KiB | 1.20 MiB/s, done.
When the command prompt returns, the repository has been downloaded successfully. The scripts themselves are tiny — just a few kilobytes. The large download (the actual Ubuntu filesystem) happens later when you run the install script.
// 09 — Step 4: Navigate to the Cloned Directory
After cloning, you need to move into the newly created folder before running the scripts inside it. Use the cd command — "change directory" — to do this:
cd ubuntu-termux
Confirm you are in the right place by listing the files:
ls
You should see files like install.sh, start, and a README.md. These are the files that make the Ubuntu environment work. If you see them listed, you are in the right place and ready for the next step.
// 10 — Step 5: Grant Execute Permission to the Script
On Linux systems (including Termux), files have permission settings that control who can read, write, or execute them. When you download a script, it does not automatically have permission to run as a program. We need to grant that permission using chmod:
chmod +x install.sh
chmod stands for "change mode" and it modifies file permission settings. +x means "add execute permission." After running this, install.sh can be executed as a program. This command produces no output when successful — silence means it worked. If you see an error message, something went wrong. Otherwise, move to Step 6.
// 11 — Step 6: Run the Installation Script
This is the main event. Running the installation script starts the automated process of downloading and configuring Ubuntu inside Termux. Run:
bash install.sh
What happens next involves several stages and takes time. First, the script detects your device's CPU architecture — ARM, ARM64 (most modern phones), or x86 — and determines which Ubuntu filesystem version to download. Second, it downloads the Ubuntu root filesystem, typically a compressed archive between 100 MB and 300 MB. This is the longest part — expect five to twenty minutes depending on your connection. Third, it extracts the archive and sets up the directory structure inside your Termux home folder. Fourth, it configures PRoot and creates the start script you will use to launch Ubuntu.
While all this is happening you will see file names, progress messages, and extraction output scrolling through your screen. All of it is normal. Do not close Termux. Keep your screen on. Plug in your charger if the battery is below 50%.
// 12 — Step 7: Launch Ubuntu
The installation is done. Time to start Ubuntu. The install script created a start file in your current directory specifically for this. Run:
bash start
After a brief moment, your terminal prompt will change. Instead of the Termux prompt, you will see:
root@localhost:~#
You are now inside Ubuntu. That prompt tells you everything: root means you are logged in as the administrator, localhost is your Ubuntu hostname, and the # symbol is the standard Linux root prompt. Every command you type from this point runs inside Ubuntu — not Termux.
// 13 — Step 8: Verify the Installation
Before doing anything else, confirm Ubuntu is installed correctly. Inside your Ubuntu shell, run:
lsb_release -a
This command displays information about the Linux distribution. You should see output like this:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
If you see Ubuntu listed as the distributor, your installation was successful. The exact version depends on which version the install script uses, but any LTS version is perfectly fine.
You can also check the kernel Ubuntu is running on:
uname -a
The kernel version shown will be the Android kernel — this is completely expected. Ubuntu shares the kernel with Android rather than running its own. This does not affect functionality for regular use in any meaningful way.
// 14 — Step 9: Update Ubuntu and Install Packages
Just like with Termux, the first thing to do inside a fresh Ubuntu installation is update and upgrade all packages. Ubuntu uses the apt package manager. Run these commands inside your Ubuntu shell:
apt update && apt upgrade -y
This can take several minutes depending on how many updates are available. Let it run fully. After it finishes, start installing tools. Here are the most useful ones to begin with:
apt install nano git curl wget -y
nano is a simple terminal text editor — much easier to learn than Vim for beginners. git gives you version control inside the Ubuntu environment. curl and wget are download tools for fetching files and interacting with APIs from the command line.
Install Development Languages
# Python 3
apt install python3 python3-pip -y
# Node.js and npm
apt install nodejs npm -y
# PHP
apt install php php-cli -y
# C/C++ compiler and build tools
apt install build-essential -y
build-essential is a meta-package that installs GCC, G++, Make, and other tools needed to compile software from source. Essential if you plan to build any software that does not have a pre-compiled package available.
// 15 — Step 10: Exit and Restart Ubuntu
When you are done working, exit Ubuntu and return to Termux with:
exit
This closes the Ubuntu session and returns you to the regular Termux prompt. Your Ubuntu environment is not deleted — it stays on your device exactly as you left it, with all installed packages and files intact.
The next time you want Ubuntu, you do not need to go through installation again. Just navigate to the folder and run the start script:
cd ~/ubuntu-termux && bash start
To make this even faster, create a permanent alias in Termux. Run this once in your Termux home directory (not inside Ubuntu):
echo "alias ubuntu='cd ~/ubuntu-termux && bash start'" >> ~/.bashrc && source ~/.bashrc
After running that, you can type ubuntu at any time in Termux to instantly launch your Ubuntu environment. One word, done.
// 16 — Useful Ubuntu Commands Reference
Here is a quick reference of commands you will use regularly inside your Ubuntu shell:
| Command | What It Does |
|---|---|
apt install [package] | Install a new software package |
apt remove [package] | Uninstall a software package |
apt search [term] | Search for a package by name or keyword |
apt list --installed | List all installed packages |
ls -la | List all files including hidden ones with details |
cd [directory] | Change to a different directory |
pwd | Print the current working directory path |
mkdir [name] | Create a new directory |
rm -rf [name] | Delete a file or directory — use carefully |
cat [file] | Display the contents of a file |
nano [file] | Open or create a file in the nano text editor |
python3 [script.py] | Run a Python 3 script |
curl -O [URL] | Download a file from a URL |
df -h | Show disk space usage in human-readable format |
free -h | Show memory usage in human-readable format |
top | Show running processes and system resource usage |
whoami | Print the current user name |
echo "nameserver 8.8.8.8" > /etc/resolv.conf | Fix DNS if internet stops working inside Ubuntu |
// 17 — What You Can Do with Ubuntu in Termux
Having Ubuntu on your Android phone opens up a wide range of practical possibilities. Here are the most popular use cases.
Software Development on the Go
With Ubuntu inside Termux, your Android phone becomes a mobile development environment. Write, test, and run code in Python, JavaScript, Java, C, C++, Ruby, PHP, and many other languages. Students who do not always have access to a laptop can practice coding from their phone. Developers travelling light can continue work without needing a computer.
Learning Linux System Administration
Ubuntu is widely used in server environments worldwide. Learning to manage an Ubuntu system — installing software, managing users, editing configuration files, setting up services — is a highly valuable skill for IT professionals and DevOps engineers. Having Ubuntu on your phone gives you a free practice environment you can experiment with without risking important data.
Running a Local Web Server
Install Apache or Nginx inside Ubuntu and run a local web server on your Android device. Test web applications, serve files over your home network, or learn how web server configuration works. Other devices on your network can access the server using your phone's local IP address.
Python Data Science
Ubuntu's package system gives easy access to Python's data science ecosystem. Install NumPy, Pandas, Matplotlib, and Scikit-Learn. While your phone may not have the power for heavy analysis, it is more than capable for learning, exploring datasets, and running scripts.
SSH Client
With OpenSSH installed inside Ubuntu, your phone becomes an SSH client for managing remote servers from anywhere. Connect to your VPS, make quick configuration changes, restart services — all from your phone while away from your desk.
Practicing Cybersecurity
Ubuntu provides access to a wide range of legitimate networking and security tools useful for learning how networks work, practicing on your own devices, and studying for certifications like CompTIA Security+, CEH, or OSCP. Always use such tools only on systems you own or have explicit written permission to test.
// 18 — Troubleshooting Common Errors
Cannot connect to repository or package download fails
Almost always a network issue. Check your internet connection and try running pkg update again. Switch from mobile data to WiFi if possible. If it keeps failing, try changing your Android DNS settings to Google (8.8.8.8) or Cloudflare (1.1.1.1).
Permission denied when running install.sh
You may have skipped Step 5 or the permission did not apply correctly. Run chmod +x install.sh again, then try bash install.sh.
Installation stops or freezes midway
Almost certainly caused by Android killing the Termux process through battery optimization. Go to Settings → Battery → Battery Optimization and add Termux to the exempt list. Then delete the partial download and start from Step 3.
No space left on device
Your device does not have enough free storage. Free up space by deleting unused apps, photos, or videos, then try again. A minimum of 2 GB free is needed to complete the installation.
Ubuntu launches but has no internet access
The DNS configuration did not set up correctly. Fix it by running this inside Ubuntu:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
The start script does not work
Make sure you are inside the ubuntu-termux directory first. Run cd ~/ubuntu-termux and then try bash start again. Also confirm the folder was cloned correctly and is not empty with ls.
lsb_release: command not found
Install it with apt install lsb-release -y inside Ubuntu. Some minimal rootfs images do not include it by default.
// FAQ
exit, then return to your Termux home directory and run rm -rf ~/ubuntu-termux. This completely removes the Ubuntu installation and all its files. Your Termux environment is unaffected and nothing else on your phone is touched.// 20 — Conclusion
Installing Ubuntu in Termux is one of the most powerful things you can do with an Android smartphone. It transforms a pocket-sized consumer device into a fully functional Linux workstation — capable of running software, hosting servers, writing and executing code, and exploring the depths of an operating system that powers much of the internet and the tech industry.
We covered everything from the ground up in this guide. The technical background of how PRoot allows Ubuntu to run without root access. Every command explained clearly with the reason behind it. Troubleshooting for the most common issues. A comprehensive FAQ for the questions beginners always ask. The entire process from Termux installation to a working Ubuntu environment, step by step.
The steps in summary: update Termux, install Git, clone the script from GitHub, navigate into the directory, grant execute permission, run the installer, and launch Ubuntu with the start script. Once inside, update your packages and start exploring Ubuntu's massive software library through apt.
What you do from here is entirely up to you. Dive into Python programming, set up a Node.js application, learn Linux system administration, practice networking, work through CTF challenges. All of these are worthwhile paths that build real, marketable skills — and your Android phone can support all of them.
For more guides like this one, keep checking hydratermux.blogspot.com. New tutorials from Rixon Xavier are published every week covering Termux setups, Linux on Android, ethical hacking education, and developer tools.
ubuntu in Termux to launch your Ubuntu environment anytime. Welcome to Linux on Android. Happy coding!
Comments
Post a Comment