Install a Linux distro on Android

Put Linux on your Android device using the Linux on Android app and keep a portable open source computer in your pocket with our tutorial.
A compatible, rooted Android device LinuxonAndroid app:
Ever since Android was launched, people have being to trying to make the most out of these pocketable devices which are more and more able to double up as portable computers.While Android was built upon Linux, it’s not truly the same kernel any more and with the proliferation of ARM-compatible distros, the prospect of putting Linux on an Android device to unlock its full potential is very attractive.
With LinuxonAndroid (LoA), not only can you get a Linux distro on an Android device, but you can also keep the original OS on there to use as normal. LoA uses a virtual machine to install a selection of supported distros to your phone.

Install a Linux distro on Android

This requires root access to your phone and while it doesn’t support every single Android device, there are over 500 supported. This includes the Google Nexus 4, 7 and 10, and the Samsung Galaxy S III and 4.
Currently, the distribution selection is quite small – Ubuntu 10.04, Ubuntu 12.04, BackTrack Linux and Debian are available to install right now. There is work going on to get support for Fedora, Arch and more, and this tutorial will work for them as well when they are eventually released.
Install a Linux distro on Android
Root your phone
Most Android devices have a different root method, some easier than others. There are some common elements between them – making sure to back up, unlocking the bootloader, possibly flashing a recovery. The Nexus 4 can be one of the harder devices to unlock, so we will focus on that.
USB debugging
You’ll need to turn on USB debugging from the developer menu on all devices for this. Jelly Bean or newer Android builds have developer options hidden by default, but you can activate them. Go to ‘About phone/tablet’ and tap ‘Build number’ seven times to unlock it, then check ‘USB debugging’.

Download root tools
The site has a number of compressed files with rooting tools for a variety of devices. Download the correct one for your phone or tablet, extract the files, and then navigate to the new folder in the terminal and type:
$ sudo chmod 755 *
Connect your device to your PC now.

Back up
The Nexus 4 needs to be wiped to unlock the bootloader, so the tools come with an ADB backup solution. In the same terminal you just used to make the files executable, run the following command:
$ ./adb-linux backup -apk -all -f backup.ab
Click ‘Back up my data’ on the device. This will not save data on the internal storage, though.
Unlock bootloader
Turn off your device and reboot into the bootloader. On Nexus devices, hold volumedown and power buttons to do this. Once it’s turned on, you will be presented with the bootloader screen. Now type in your terminal:
$ ./adb-linux oem unlock
Select yes using volume keys and power button.

Superuser files
Turn your device back on and go through the setup process – skip it for now. You’ll need toput onto your Nexus storage, either via AirDroid or by downloading it straight from through the browser.
Recovery mode
Reboot your phone back into the bootloader and make sure the USB cable is still plugged in. In the terminal, type:
$ ./fastboot-linux flash recovery recovery-clockwork-touch-
Use the volume buttons to select Recovery mode and press power.

Flash recovery
Select ‘Install zip from sdcard’, followed by ‘zip from sdcard’ and then 0/. Choose and then hit Yes. After that’s done, select Reboot; if asked if you want to disable Flash Recovery, select yes. Afterwards, you should find the SuperSU app in your device’s app drawer.
Your Nexus 4 should be rooted – open the SuperSU app to run some binaries and make some changes. Check out to finish rooting other devices on Linux, with the Galaxy S phones being fairly easy and not requiring a wipe.

Install apps
Now you’re all rooted and superuser’d, install three apps from the Play Store: Complete Linux Installer, androidVNC and Terminal Emulator. You can find links to these in the guide for Complete Linux Installer’s distros. Install these after rooting, not before.
Download image
You can download the images from the LinuxonAndroid SourceForge project page, or via the distro guides on the app. The Ubuntu and Debian images come in three sizes: Core for a command-line interface; Small for LXDE; and Full for Unity. Each is larger than the last, and heavier, so choose carefully.
Unzip image
Use an Android file explorer such as Astro File Manager and navigate to the zip files on your device. Move them to a folder named after the distro with lower-case first letter (ubuntu, debian, backtrack) and extract them into the folder. This will have the image and md5 sum.
Launch distro
Go back to the Complex Linux Installer app and open the sidebar. Select the correct distro from the drop-down list and click Launch. This will open a terminal and check the md5 hash before guiding you through some extra setup processes.
First-time setup
It will run through some setup options with you. Firstly enter a password for the image; make sure to use the name of the distro. You’ll be asked if you want to turn on VNC and SSH servers – VNC is mandatory, but SSH is optional.
Set the resolution to your device’s, save the profi le and wait until ‘root@localhost’ shows up.
Now you need to connect to the VNC server you just turned on. To do this, go to androidVNC, set the password to the name of the distro with the first letter lower-case, put localhost in the address, and set the port to 5900. Finally, press Connect and you will be put into the desktop of the selected, running image.
If you put a larger resolution than the screen can show, or zoom in, you can move around the desktop by swiping your finger. The mouse pointer reacts as you touch the screen, rather than following your finger, so you’ll need to hold down your thumb or finger to drag files or directories.
Shut down
Don’t just turn off the terminal emulator when exiting the distro – this will not turn off the distro, and you’ll need to then reboot your phone to get it to properly boot again. Instead, go back to the terminal emulator and type ‘exit’. Wait until it’s fully shut down, then exit the window.
Phone IP
You can connect to the Linux session running on your phone via a remote desktop client on your PC. The first thing you’ll need to do is make sure your phone is connected to the same Wi-Fi network as your PC. Press the wireless connection in the Wi-Fi menu and note down your local IP.
Open a VNC client on your PC and click on a new connection. Ensuring the protocol is set to VNC, enter the IP address of your device followed by :5900 to specify the port. Use the distro password for the username and password, set colour depth to 24-bit if needed, and connect.
Install package manager
You’ll need to install apps from the terminal, and it’s faster to do it from the phone or tablet’s terminal emulator. If you want to be able to install with a graphical package manager, use:
# apt-get install synaptic
…to install the Synaptic Package Manager.
App limitations
As we’re using the ARM version of the distros, there won’t be the same number of apps available as for the x86 versions. For example, Wine on ARM is still under heavy development, and is not recommended. Make sure to download ARM binaries as well when installing that way.
Having a portable Linux distro on your phone can be great for many things. With the VNC capabilities, you can use it as a portable desktop, much like Ubuntu for Android. The storage on the device is permanent, so it will save any files and cookies for access to cloud storage.
More Uses
Alternatively, in command-line mode you can have a low-power, portable and small file or web server. Thanks to BackTrack being available, you also have a portable network sniffer and vulnerability checker.
More to do
If you’re still looking to do more with your device, the LinuxonAndroid website has a number of advanced tutorials on how to expand the storage, run apps through the Android activities manager and much more. Now you truly have a PC in the palm of your hand.
7Review earns Amazon affiliate commissions from qualifying purchases. You can support the site directly via Paypal donations ☕. Thank you!
We will be happy to hear your thoughts

Leave a reply

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