Android itself is a great operating system for smartphones. It gives you flexible controls and extensive customization options by installing 3rd party applications (APKs) from Play Store. While that’s incredibly easy but it comes with a privacy compromise.

Termux Emulator Runing Android
Termux Terminal Emulator running in Android Custom ROM, LineageOS 17.1

Almost every Android app these days asks for Phone’s Storage, Location and Camera access permissions which is questionable act and privacy nightmare.


This is where Ubuntu 20.04.1 (Command Line Interface) comes in. Ubuntu is a widely used distribution flavor of GNU Linux that is easy to use and compatible with many devices. By installing Ubuntu Linux on our Android phones we can simplify, automate and schedule many daily tasks and preserve the phone battery life at same time.

However, the requirement is that we must understand basic Linux (Bash) commands first, but don’t worry about that now.

Benefits of Installing Ubuntu on your Android phone:

Here’s a short list of things that you can do after installing Ubuntu 20.04.1 through Termux (Terminal Emulator) for Android. The great things is that Rooting or Unlocking Bootloader or installing Recovery (e.g. TWRP) is not required.

• Ability to run Python v3.5.8+ programs and scripts (.py)

• Run crontab (crond) to automatically run Bash scripts/tasks at specified times.

• Make Bootable Windows 10 USBs for your Desktop PC

• Use aria2c download manager to download magnet links, get files multi-threaded/connections.

• Host Websites from your Android phone by installing Nginx, MYSQL and PHP

• Make use of Termux-url-opener and Termux-setup-storage to automate the downloading of files using “Share” dialog box on Android OS.

• Install Qbittorrent-nox (WebUI), Transmission WebUI to remotely download legal torrents

• Control your Phone from other devices on your LAN using SSH (openssh-server)

• You can automate your phone to capture a Picture at specific intervals using Termux API.

How to Install Ubuntu 20.04.1 (CLI) on Android 7/8/9/10

It is recommended that you use at least Android 6+ for this guide so you don’t get compatibility issues.

Download Termux app from Play Store. It is free and allows you to run Bash terminal where you can run Linux/Unix commands and execute bash scripts.

Termux play store techkhoji
Play Store page of Termux Emulator for Android

Once the installation is done, start Termux from your Launcher or Home Screen. You will be greeted with Black screen with some text, and $ sign. Don’t panic, it’s totally normal. Just Tap on $ sign and keyboard will pop-up. This is where we will type and enter commands.

Termux launcher icon crop
Termux Launcher Icon on Android Home Screen on Android 10

The black screen, you are seeing is called Command Line Interface (CLI) or Terminal.

Now type the commands given below, after entering one command, wait for the process to complete and then proceed with the next. Some commands will output what is happening (Logs) some will not. Don’t worry when that happens. Don’t copy the $ sign, it is for reference only. 

Termux lineageos techkhoji e1596821705784
Typing command into termux shell inside Android OS

Note: Package installation and scripts usually ask for User confirmation with Yes or No. Typing Y and hitting Enter will give the terminal to go ahead with command.

$ apt update && apt upgrade

This command will update the software package list and upgrade the software afterwards. The && sign we placed in between tells terminal to perform one task and then do the other.

$ apt install wget -y

Now that we have upgraded our Terminal packages. It is time to install wget. It is a file retriever like IDM but for command line, it can download content from many protocols.

$ apt install proot -y

proot (chroot) allows us to run Ubuntu under user specific directory without permission issues. It is basically fake root, you can do anything except making changes to internal hardware of phone. For example; Android Debug Bridge (ADB) shell is not supported as it requires root.

$ apt install git -y

Git will help us clone the open-source script from Github. The script will be used for installing Ubuntu using proot on Termux.

$ cd ~ && git clone && cd ubuntu-in-termux

The above command will open your $HOME directory and then clone (download) the script from git and then access the directory where it is cloned.

$ chmod +x

This command will give current user (you) permission to execute script. You can alternatively enter “bash -y” to directly run the installation script.

$ ./

This command will execute and start the downloading and installation of Ubuntu 20.04.1 Root filesystem.

Note that this operating system is minimal and does not have desktop environment (GUI), such as XFCE. The reason we have installed the Ubuntu CLI is that it is not resource hogging and perfect for running on Mobile ARM64 / aarch64 supported CPUs.

Once the installation script has completed the process, now we run finally start the Ubuntu

$ ./

After you hit enter, your the $ sign in Termux will be replaced with root@localhost:-~# indicating that you are now in Ubuntu Shell (terminal).

To exit Ubuntu and go back to Termux Terminal, type exit

Few Basic Linux Commands:

These commands are universal Linux commands, they can be entered in any GNU/Linux shell, regardless of distribution you are currently using. To utilize the Termux to its full potential, you must Google and learn Linux commands, they are really easy but dedication is required.

pwdShows present working directory

ls -a  shows the list of directories and files, including hidden files

mkdir foldernamecreates new directory in directory in pwd

rm filename.txtremoves the file in pwd

cd directoryname opens the directory

cd ~ – Takes you back to $HOME directory, it’s like the User folder in Windows.

uname -a – Shows system information, Linux OS name, Kernel, Platform and so on

What to do after installing Ubuntu in Termux (Android)

0. Important Initial Step

It is a good practice to give Termux permission to internal storage of your phone.


Once you enter this command, Android OS will ask for storage permissions, click “Allow“. Doing this will give Termux to access the internal storage eMMC / SD card of your Android OS. You can copy, move and share files between Termux shell and your Android storage back and forth.

1. First thing you must do is to update the repositories and upgrade the packages.

root@localhost:-~# apt update && apt upgrade

2. Install Python and PIP for downloading programs and running scripts:

root@localhost:-~# apt install python3 python-dev python3-pip

3. Install wget, curl and git for acquiring files from different sources

root@localhost:-~# apt install git curl wget

4. Install useful Python Packages using PIP

root@localhost:-~# pip install --upgrade youtube-dl gallery-dl ffmpeg

5. Install nginx (http) server for hosting websites

root@localhost:-~# apt install nginx


Remember! the possibilities as I mentioned are endless. The prerequisite is that you must learn basic Linux (Bash) commands to navigate between directories and give basic arguments to commands. If you would like more tutorials on Termux / Ubuntu, do let me know through comment section.


  1. Tried to clone linux from the github address you specified but was met with a request for a user and password. I do not know what to enter for those credentials so I was unable to install (clone) ubuntu. I sthere a work-around for this?

  2. Would like more tutorials. Newbie. I have installed ubuntu multiple times on termux but can not get a desktop to work. Tried gnome and xfce4 still having problems. removed and purged ubuntu and tried to start over multiple times but still having problems. Everyone tells you how to install it but need step by step instructions on what to do with it once installed. I used Anlinix to install it. Got proot set up. But what now, my understanding is it comes with gnome desktop. Even tried installing gnome3 desktop.

  3. @Janie.

    Thanks for commenting.

    I would not really recommend running Desktop environment on Termux for many reasons. Termux does not have proper support for hardware acceleration, even if you manage to run the xfce4, it will be laggy and unoptimized.

    Currently, I have Termux setup on my phone, I’m using it mainly for YouTube-DL, Gallery-Dl and Streamlink to easily download content on my phone using Termux API (termux-url-opener).

    So if I want any video or download stream from a web page, I just click “Share” button on Android Chrome and select Termux from Share menu and then it asks me what kind of media I want to save to my phone.

    An example repository on GitHub:

    I will post a tutorial about it some day.

  4. root@localhost:-~# pip install –upgrade youtube-dl gallery-dl ffmpeg
    change is to pip3 pip don’t work

  5. @Justin Weber I’m not able to run Ubuntu on my Android 10 device. I’ve already watched one YouTuber’s video and using his and yours steps, I successfully downloaded and installed Ubuntu 20.04.1 using Termux and Andronix. I’m a second year Information Technology engineering student from Mumbai and I need to submit my Linux experiments to my college digitally. My desktop and laptop are in my home in mumbai. I came to my hometown Calcutta alongwith my parents for some family work. But I haven’t carried my laptop with me to avoid the risk of my laptop being stolen. Please help me. I’ve to perform it on my phone only.

  6. Thank you so much dear! My college teacher of Operating System subject, told me that she wanted us to not only download and install the Ubuntu, but also check whether the computer will boot from the USB.
    Make BIOS Changes.
    Try Ubuntu before install it.
    Create Bootable USB.
    Create a username, password, and computer name.
    I’d messaged her and she told me it’s absolutely okay as I’m away from Mumbai in my hometown Kolkata and didn’t carried my laptop with me to avoid the risk of it getting stolen. She told me to take the experiment from your friends and upload it as it is. Just I’ve to do the writing part.
    BTW, I’m not able to browse the internet on Firefox browser on Ubuntu in my phone. It’s showing “Gah. Your tab just crashed.” Please help me out with this issue.

  7. This guide is preety good. What I like these programs are nginx-light, qbittorrent-nox, and openssh-server. I’ve tried qbittorrent-nox (running my Debian Unstable minimal on Termux 0.180.0 with Proot-distro) and I was able to download files on my mobile device as a server. On top of that, it works perfectly to store files by accessing /sdcard/ or /storage/emulated/0/ (requires storage permission) for qbittorrent-nox which Proot-distro has. Other programs I mentioned never tried it, so I need more research to learn some things. Once again, this is amazing to try out much using termux just like a server on a desktop to a mobile platform.

  8. @Kamisato Ayaka

    Termux out of the box supports many programs. Ubuntu is for extras binaries/programs that cannot be installed on Linux which comes with termux.

    It is truly a brilliant shell environment, however ports 1-1000 are restricted, nginx webserver can work, but on non-standard ports.

    I have more guides in mind regarding termux, and it’s termux-url-opener feature which I will write later on.

    Thanks for your input.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.