Setting up Termux and a Linux Distro on Android
Tags: linux, termux, programming, tutorial
Published: 2022-11-11 02:14:02

---
title:Setting up Termux and a Linux Distro on Android
published: true
tags: #linux #termux #programming #tutorial
canonical_url: https://dev.to/sarahokolo/setting-up-termux-and-a-linux-distro-on-android-1aoj
---

###**WHAT IS TERMUX?**

Termux is a free and open source terminal emulator for Android which allows for running a Linux environment on an Android device.
**_in simple terms:_** Termux is an application(app) that can be installed on any Android device. This app is used to provide a terminal environment right on your smartphone. Thought you could only use a linux terminal on a PC or desktop? well turns out you could actually have one right on your smartphone that runs exactly the same as the one on your PC. 

With Termux, you can code anywhere, with just your smartphone, if you don't have have access to a PC at any point,  termux is great to help with any of your programming related needs.

###**WHAT IS A LINUX DISTRO?**
A Linux distribution (often abbreviated as distro) is an operating system made from a software collection that includes the Linux kernel and often, a package management system. Linux distros consist of what are called software packages. These packages contain specific files, applications or services. A package could be a collection of fonts, web browsers or development environments. A single Linux distribution could contain thousands of software packages.


Running a linux distro in your termux is very important to give you the complete feel of using a linux terminal in your PC. 

In this article, i would be walking you through not only setting up your termux, but also running a version of any of the varieties of linux distros out there.

###**HOW TO SETUP TERMUX**
There are only a very few steps to setting up termux on your Android device.

I would have taken you through downloading termux directly from playstore, but unfortunately the version of termux available there has been depreciated and no longer receives updates. So we would be going through a more convenient route.
**Key**: if you had previously installed termux directly from playstore, delete it, then follow the below steps.

1. Go to playstore and download an app called [Andronix](https://play.google.com/store/apps/details?id=studio.com.techriz.andronix).

2. Once the app is done installing, open it and this is the first page you would come across 👇

![First page of the Andronix app](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtzej3loex6orvjrhbya.jpg)
These icon that you see are the different linux distros out there, you are to select one to set up in your termux. If you are a complete beginner and have no idea about how linux distros work or which one you need, just use the **Ubuntu distro**, this is one of the most widely used linux distros out there, and it's beginner friendly as well. Well which one is Ubuntu?  
It is the first orange coloured icon you see, click it to get started.

3.Once you click that icon, it should take you to this page 👇

![Ubuntu distro page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1gb5e17d38tpds40t9ss.jpg)
Click on **proceed**.

4. After you have clicked the proceed button, it should take you to this page 👇
![Ubuntu version download page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jl5kgwq7w3v9ar9nv3dr.jpg)
In this page, you are asked to pick what version of Ubuntu you would like to download. Again if you don't know, i would advice you to go with the **20.04(Focal fossa)** version, so click on that one.

5. If you clicked on the **20.04(Focal fossa)**, you should arrive at this page here👇
![installation page of Ubuntu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxtr1nxd0ldh5u3ho2yh.jpg)
Click on **install**

6.After you clicked on the install button, it should take you to this page here👇

![Ubuntu installation page 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ngcwrfv0gb2ansxu7eb.jpg)
Click on **CLI only** 

7. After that, it should take you here 👇

![Ubuntu installation 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvc28vg6neulpwbcrppj.jpg)
Click on **open Termux** this should direct you to the proper place to download termux (fdroid).
**Important:** There is a command that the Andronix app automatically copies into your clipboard when u on this page. Keep the command safe as i would show you where you would be needing it later on. (if you lose it, just go back and click the **Recopy** button).

8. After your termux has been installed, open it, and it should look something like this 👇

![Termux terminal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/parpnv35qxzbvdtt3zci.jpg)
You are in termux now, but termux is still plain.

Remember the command that was previously copied into your clipboard that i said to keep safe?  Well here is where you use it. 

So what you do now is to immediately paste the command into the terminal(click anywhere on your screen in the terminal and click paste) and click *enter* to run.

**Note:** This is the first thing you should do once you get into termux.

 This would update and upgraded all packages and dependencies and set up your Ubuntu environment.

Once it's done installing and setting up,
Close termux...exit the session entirely(type **exit** in the terminal and click enter) like this👇

```
$ exit
```
then open a fresh session (reopen your terminal)
Then paste and run this command 
```
./start-ubuntu20.sh
```
This should start up your Ubuntu environment in your terminal 
then your termux is fully ready. Your prompt should now look like this:
``` 
root@localhost:~# 
```
Now go and spread forth your favourite linux commands😁😁

But wait a litte, after you have set up Ubuntu in your termux, you might experience an issue of not being able to install any package like git or vim(please ignore the following if you can easily install these packages already). This error might be because of the DNS, what you have to do now to solve this is to change your DNS settings in Termux to use a reliable DNS server. For example, you can use Google's public DNS servers.

Just paste and run this command in your terminal and everything should be resolved:
```
echo "nameserver 8.8.4.4" > $PREFIX/etc/resolv.conf
```

#### **PS**: If you decide to switch from Ubuntu to any other linux distro, it's very easy, simply just go back into your Andronix app and start from **step 2** in this article and click the icon of the distro you wish to switch to.

⚡⚡⚡Kindly like and give me a follow if you found this post helpful 😊. If you have any questions, simply drop them in the comment section and i would be glad to answer them. See you next time 😉