This is the easiest way to run Linux distros on your Android phone
You can run pretty much any popular Linux distribution on your Android phone in a few simple steps. With the right scripts, you can even install a fully-featured GUI distro with the desktop environment and window manager of your choice. Let me show you how.
Use Linux within a terminal
If you only need the command-line interface for the Linux you're trying to install, Termux is the simplest option. Among the many cool things it can do, Termux allows you to install and run many distros within its shell. It's a lot like the Windows Subsystem for Linux , which provides you with a full Linux distro within the terminal.
Start by installing Termux. It's available on the Play Store, but that version is heavily restricted and not updated regularly. The real version of the app is hosted on F-Droid (a free and open-source app store for Android). You can either install the F-Droid store or download the APK file from F-Droid and sideload it.
Termux | F-Droid - Free and Open Source Android App Repository
Price: Free
1969-12-31
F-Droid
Once you've installed Termux, open it. Type and run the following command to sync and update packages.
Press "Y" for confirmation and then Enter, if prompted.
Next, we'll install the distro manager tool.
Let's look at the list of Linux distributions available through this tool.
Note the tag next to the name of the distribution. We'll need it to install the target distro. For example, to install Alpine Linux, run the following command.
Use this command to launch Alpine Linux.
Get the full desktop experience
You can even get the full graphical distribution with a desktop environment of your choice. This setup gives you a cursor you drag around and tap on the display to click. There's a virtual keyboard with PC keyboard shortcuts like the super key and arrow keys. If you want to use it for actual work, you can connect a mouse and keyboard to the phone. The official command-line package manager will automatically pull the compatible apps with your phone's chip architecture.
We need three things to make this work.
-
The script for installing the desktop distro on Android
-
Termux
-
A VNC viewer app of your choice. I'm using RealVNC Viewer .
Andronix is an app that provides you with commands you can run to install a full desktop Linux system on Termux. We copy the command from Andronix, paste it into the Termux shell, and wait for it to complete the installation. We'll then use Termux to log into the Linux distro and start a VNC (Virtual Network Computing) server.
Basically, we run the operating system in one app, and we interact with the system on a different app.
You can scroll through the list of available installers on Andronix, choose a distro , its version, and the desktop environment or window manager.
A lightweight window manager works best on phones, but you can also use the XFCE desktop environment. If you don't need the GUI at all, there are CLI installers too.
I selected Ubuntu with the XFCE desktop environment and pasted this command to start the installer.
You'll be prompted to select a timezone and a keyboard layout. You can do so by typing the number next to the target item and tapping Enter.
The installer will eventually ask you to set a password for the VNC server. We'll need this password to connect to the session in the VNC viewer app. This script automatically launches the VNC server for me, but if yours doesn't. Run this command.
With the VNC server up and running in Termux, open the VNC viewer app of your choice. I'm using the RealVNC Viewer app. The address is ,localhost:1and the password is what you set during the setup in Termux. Hit connect and wait for it to drop you onto the desktop.
You can drag the cursor around with your finger, click once with one tap, and double-click with two taps. You can tap the keyboard icon to pull up the virtual keyboard. There's also a virtual trackpad overlay, which gives you three mouse buttons and a scroll bar.
Occasionally, you might see some lag or the VNC Viewer might fail to connect. If that happens, try stopping and starting the VNC server again.
Then run,
You should see decent performance when running the full desktop experience, even on mid-range phones. If it has a powerful enough chip, a tablet with a keyboard and a mouse could serve as a wonderful workstation. If you don't need the GUI overhead, you can run any popular distro and access its packages inside Termux.
