Mobile devices today have computing power that seemed fantastic for desktop PCs ten years ago. This opens up the opportunity for enthusiasts to turn their smartphone into a full-fledged workstation. Installing the distribution kit Linux on the platform Android allows you to run servers, code compilers and even graphical applications right in your pocket.

There are several methods for implementing this task, from simple terminal emulators to complex schemes with changing the bootloader. However, the safest and most accessible way for most users is to use the application Termux in conjunction with project scripts. This method does not require obtaining root accesswhich preserves the warranty on the device and the integrity of the security system.

In this guide we will look at the step-by-step process of deploying the environment Debian or Ubuntu inside the operating system of your smartphone. You can access thousands of repository packages and use the power of the Linux kernel to solve specific programming or administrative tasks.

Device preparation and tool selection

Before you begin installation, you must ensure that your device meets the minimum requirements. It is advisable to have a smartphone with at least 4 GB of RAM, since heavy distributions like Kali Linux can consume significant resources. Also free up some internal storage space, as the system image and cache can take up anywhere from 2 to 10 GB.

The key to running it is the terminal emulator. Previously, the application Termux was available on Google Play, but the version in the store is outdated and no longer supported by the developers. For correct operation, you need to download the current build from the repository F-Droid or from the official project page on GitHub.

  • ๐Ÿ“ฑ Download the latest version Termux from a reliable source (F-Droid).
  • ๐Ÿ”‹ Make sure that the battery charge is more than 50% or connect a charger.
  • ๐Ÿ’พ Prepare at least 5 GB of free space in the internal memory.
  • ๐ŸŒ Ensure a stable Wi-Fi connection to download packages.

โš ๏ธ Warning: Do not try to use versions of Termux from the Google Play Store or third-party APK sites of unknown origin. They may contain vulnerabilities or incompatible libraries, which will lead to errors when installing the subsystem.

๐Ÿ“Š Which Linux distribution are you planning to install?
Debian
Ubuntu
Kali Linux
Arch Linux
Other

Basic setup of a terminal emulator

After installing the application, run it. When you first launch it, you will see a black screen with a command prompt. The first step is to update the package lists and the underlying utilities themselves to avoid dependency conflicts in the future.

Enter the update repositories command. The system will ask you to confirm the action - enter y and press Enter. This process may take several minutes depending on the speed of your Internet connection.

pkg update && pkg upgrade

Next, you need to give the application access to your device storage. Without this, you will not be able to save files created in the Linux environment to the phone's shared folder. Run the command termux-setup-storage and allow access in the pop-up window.

To work with graphical interfaces or run heavy scripts, you will also need to install additional packages, such as wget, proot and tar. These utilities are responsible for downloading disk images and mounting them into a virtual file system.

๐Ÿ’ก

Use the Ctrl+C key combination to emergency stop a frozen process in the terminal if the installation script has stopped responding.

Installing the distribution via Proot-Distro

The most modern and a convenient way to install a full-fledged Linux is to use a script proot-distro. This tool allows you to install various distributions in an isolated directory without affecting Android system files.

First install the script itself through the Termux package manager. After installation, you will be able to view a list of available operating systems that can be deployed with one command.

pkg install proot-distro

proot-distro list

Select the desired distribution from the list. For beginners, it is recommended Ubuntu or Debian due to their stability and extensive documentation. To install, for example, Ubuntu 22.04, enter the appropriate installation command.

proot-distro install ubuntu

The downloading and unpacking process will take time. Upon completion, you will be able to log into the installed system with the command proot-distro login ubuntu. Inside this environment, you will have superuser (root) rights relative to the Linux system itself, although physically / root / on the device will remain inaccessible.

Distribution Image size Complexity Recommended use
Debian ~150 MB Low Servers, stable operation
Ubuntu ~200 MB Average Development, universal tasks
Kali Linux ~800 MB High Security testing, pentest
Arch Linux ~300 MB High Advanced users, customization

โ˜‘๏ธ Preparing to install Linux

Done: 0 / 5

Configuring the graphical interface (GUI)

Working exclusively on the command line is not suitable for all tasks. If you need a graphical interface, for example, to launch a browser Firefox or development environment VS Code, you will need to set up a VNC server or use X11.

The simplest method is to install the XFCE desktop environment and VNC server inside the installed distribution. After starting the VNC server, you can connect to it through a special app on Android, such as VNC Viewer.

Inside a Linux session, install the necessary components. Please note that running graphics significantly increases the load on the processor and battery consumption.

apt update

apt install xfce4 tightvncserver

vncserver

After starting the server, it will prompt you to set a password for the connection. Remember this as it will be required in the Android client. By default, the server starts on port 5901.

โš ๏ธ Attention: The graphical interface in emulation is slower than the native one. Don't expect smooth animations like on a desktop PC; use lightweight themes to improve performance.

An alternative method for launching GUI

Instead of VNC, you can use the Termux:X11 application, which provides higher performance and hardware acceleration support, but requires more complex configuration through configuration files.

Working with the file system and network

One of the main features of the Android and Linux combination is the ability to exchange data. The environment proot allows you to mount internal phone partitions into a virtual machine. The folder /sdcard inside Linux corresponds to the internal storage of your smartphone.

This means that you can edit documents created in Linux using Android file managers and vice versa. However, be careful when deleting Android system files from a Linux environment as it may make your phone unstable.

The networking stack in Termux is fully functional. You can run web servers, such as Nginx or Apache, and make them accessible from the local network. To check the server operation, use the command ifconfig or ip addr to obtain the local IP address of the device.

If you plan to use the device as a server, configure a static IP in the router or use dynamic DNS services. This will ensure constant access to your services from the outside.

๐Ÿ’ก

Access to the /sdcard folder from Linux allows you to easily transfer files between systems without using cables or cloud storage.

Possible problems and their solutions

During operation, users often encounter architecture emulation errors. Most modern smartphones use the ARM64architecture, while some older apps are compiled for x86_64. Running such apps will require installing an emulator QEMUwhich will critically reduce performance.

Another common problem is the termination of the process when the application is minimized. Android aggressively manages memory and can kill Termux background processes. To avoid this, enable the notification in the application settings and add it to the power saving mode exceptions.

If dependency errors (broken packages) occur, it is useful to clear the package manager cache. The command apt clean will delete the downloaded package archives, and re-run apt --fix-broken install will try to fix broken library connections.

  • ๐Ÿ› "Permission denied" error: check folder permissions, use chmod.
  • ๐Ÿ“‰ Low speed: close unnecessary applications on Android to free up RAM.
  • ๐Ÿ”Œ Break connections: check the Wi-Fi sleep settings on the Android system.

โš ๏ธ Attention: Application interfaces and package manager commands may be updated by developers. If the command does not work, check the official documentation of the specific distribution or Termux repository.

Frequently asked questions (FAQ)

Do you need root access to install Linux on Android?

No, modern methods using proot i Termux allow you to run full-fledged distributions without obtaining superuser rights on the device itself. This is safer and easier for the average user.

Is it possible to run Windows apps through this system?

You cannot directly run .exe files, since the Linux kernel is different from Windows. However, you can use emulators like Wine within an installed Linux distribution, but the performance will be low and compatibility will be limited.

Does this drain the phone's battery a lot?

Yes, running an emulator and especially the GUI puts a high load on the processor. In active use mode, the battery may discharge 2-3 times faster than usual.

How to completely remove installed Linux?

To remove it, just run the command proot-distro remove inside Termux. This will remove all system files, but will leave the Termux application itself and your personal files in the storage intact.

Can this method be used for mining?

Technically, you can run the miner, but the efficiency will be extremely low due to the limitations of the mobile processor and heat sink. In addition, this can lead to overheating and rapid wear of the device battery.