How to install Linux OS on Android

A user can have many reasons why he needs to need Linux on Android. You can, for example, use it to power the LAMP server, which launches web applications and serves web pages. If the user is a network administrator, he can install his favorite Linux tools and turn the smartphone into a portable network solution for troubleshooting or checking functionality.

Device Preparation

Device Preparation




Initially, the full Linux Installer application is downloaded from the Google Play Store. In addition, you need to go to the Linux project website on Android and download the open source version of the Android application. First, go to the “Settings” menu, select “Security” and switch to the “Unknown sources” position to enable the installation of applications other than the Play Store.

The application requires an Android root device. The exact procedure required to run depends on the device models. The installer requires BusyBox to boot Linux, which will be implemented and installed the first time it starts. In addition to the application created by the Linux project on Android, you will also need a VNC viewer to use the graphical desktop. The project proposes to use the popular Android VNC Viewer application.





In addition, you will need another application to access the built-in Android command line. The project suggests using the Android Terminal Emulator application. Next, launch the Complete Linux Installer application. Click on the project icon in the upper left corner of the screen to open the navigation menu, which contains several elements. The first two of them are the most important:

  1. Installation guide, where the user will be offered the steps necessary to configure and install various supported Linux distributions.
  2. The “Launch” element is an integrated launcher that can be used to boot Linux onto a smartphone into a configured distribution.

Other items will lead to various information and tips that will help in setting up the system. The distribution setup process consists of several stages, for the implementation of which it is necessary:

  1. Launch the Complete Linux Installer application.
  2. Open the navigation menu and click on the “Install Guide” item.
  3. A list of distributions that can be run on the device appears.

Running Linux without using a device

Running Linux without using a device




You can run Linux on an Unrooted Android device thanks to the GNURoot application. Despite its name, it does not require a built-in phone. The main difference between Complete Linux Installer and GNURoot is that the latter provides access to the Linux distribution's command line interface. To run Linux on Android via GNURoot, you need to take it from the Google Play store, and also download the accompanying application for a specific Linux distribution. The application is used for popular distributions such as Debian, Gentoo and Fedora.









These applications are close in size to 100 MB, unlike the GNURoot application, which is only a few kilobytes. Once they are installed, start GNURoot and use the drop-down menu at the top of the page to select the distribution you want to download. Then click the Create New Rootfs button to install the distribution. The process will take some time depending on the resources of the device. When this is done, you need to click the Launch Rootfs button, which will open the terminal and register the user in the Linux distribution on the Android (phone). If you select the "Run as a fake root" check box before starting the distribution, then the system will be logged in with superuser privileges.

Instructions for choosing Ubuntu

First you need to click on the selected option for further instructions, for example, Ubuntu. After that, detailed instructions are displayed, divided into four pages. The first page of the application displays the basic requirements of the device for the ability to run the linux distribution on a smartphone. The most important step is to make sure that debugging support is enabled. To do this, open the “Settings”, “Applications”, “Development” sections sequentially and make sure that the “USB Debugging” option is switched on.

On the seond page, links will appear to download the image for the selected distribution. Then they click on the “Download Image” button, a window opens with three additional buttons for loading one of the three supported image types: large, small or core.

Installing the Linux OS distribution




Then you should install the Linux OS distribution to choose from, and also select the size of the downloaded compressed image, which will be displayed on the SD card after it is extracted. Next, the sequence of steps is as follows:

  1. Make sure your Android device uses the ARM v7 processor, as most distributions support only this ARM architecture.
  2. Click on image: this action will bring up another pop-up window with buttons that either download the image from the Sourceforge mirror or download via torrent.
  3. If the user selects the torrent option, the application will download the torrent file, which will then need to be transferred to the torrent client in order to download the actual image for the selected Linux OS distribution.
  4. You can download the image to your computer, and then transfer it to the SD card on your Android device. In this case, you can safely skip the instructions on this page.
  5. You can unzip the downloaded file either on the computer or on the device itself. For the latter, you will need a universal file manager, such as the paid Root Explorer application or the free ES File Explorer application.
  6. If the user moves the images to his device manually, it is better to place them inside the folder. For example, if you download images for the Ubuntu distribution, it will be more appropriate to unzip it in the Ubuntu folder on the SD card.
  7. After downloading, the user will be taken to a terminal window where instructions on how to connect to this running installation of Linux on an Android (smartphone) using the VNC viewer will be listed.
  8. You must specify the password displayed on the page, as it will be needed to connect to the VNC server running inside the distribution.

Download distribution

Download distribution




In order to launch the application responsible for downloading distributions, you need to open the navigation menu by clicking on the application icon or clicking on the launch element. Then use the drop-down menu on the page to select the distribution. If the user receives a message that the image for the selected distribution does not exist, this means that the application cannot find and extract image files for the distribution. This happens if the downloaded file was not extracted, or if it was saved in a non-standard location.

In this case, you need to manually specify the IMG file of the distribution kit when launching Linux on Android. This will require:

  1. Click the “Settings” button in the upper right corner of the “Launch” screen, which displays a drop-down menu.
  2. Click the “Add” option to open the page and record for the distribution.
  3. Enter the name of the distribution in the specified space and touch the field with three dots to go to the file system on the Android device and specify the IMG file for the distribution.
  4. Click “Save Changes”.

This custom distribution entry will now appear in the drop-down menu on the launch page. When a record is selected, the application will show a button to start the distribution.

The procedure for installing "Linux" on the "Android" tablet:

  1. Click on the button to download the distribution. This will launch the terminal application and give it superuser permission.
  2. Press Enter on the virtual keyboard to load the distribution. Since this is the first time a user has started the distribution, he will be asked to provide a default password. This is the password for the default user account, not the password required to log into the VNC session.
  3. Then the program will specify whether the distribution needs to run the VNC server to view the graphical desktop and SSH server, or to remotely access the distribution via a secure connection.
  4. It is recommended that you run them to take full advantage of running the Linux distribution on your Android device.
  5. You will then be prompted to enter a screen resolution for the VNC session. Although you can set it to any size, for a better overview, they usually install the product with the same resolution as on the device.
  6. Keep in mind that when you call the virtual keyboard, it will hide part of the desktop. This is all that is required for configuration.
  7. Then the application will offer to save the default settings and allow you to download the distribution.

Secure device setup

Secure device setup




When the distribution is loaded, the user will see a note with the appropriate settings, according to which you need to connect via VNC to this distribution, and then the standard Linux prompt will be displayed. You can use this shell to interact with the distribution, as with any desktop application. For security purposes, the user must first set a new password for root.

Security installation procedure:

  1. Log in and enter a new password for the root user. If you need to start the SSH server when the distribution is booted, you can connect to it from any computer on the network by entering the Ifconfig command inside the terminal on the Android device.
  2. Dial the IP address of the device, for example, 192.168.2.101.
  3. To connect to the device, you must start the terminal on another computer and enter: ssh ubuntu@192.168.2.101.
  4. The system will require a password for the ubuntu user that was installed the first time the distribution was booted.
  5. To view the graphical desktop running on top of the Linux distribution on an Android device, you need to press the home button and minimize the terminal application.
  6. Launch a VNC application, for example, androidVNC to install Linux on Android.

VNC desktop application

VNC desktop application




VNC has various settings to connect to the distribution that is running on the device. You need to enter localhost in the field that requests the IP address of the VNC server and 5900 as the port. In addition to this, you will also need a password for authentication with the VNC server, which depends on the distribution. For Ubuntu images, the password is ubuntu. For Arch, Linux is archlinux, for Linux, Debian is debian, and so on. The password is specified on the distribution wiki page on the LinuxOnAndroid project website.

If the user uses androidVNC, the application suggests changing the color format to 24-bit color (4bpp). Then click the “Connect” button to start a VNC session after all the information has been entered. The VNC client connects to the device, immediately displays the graphical desktop that is running in the distribution used.

Application developers advise androidVNC users to change the input mode to the touchpad. To do this, click on the menu button inside the VNC session. This will cause a lot of options. You need to click the "Input mode" option, and then select the "Touchpad" switch from the list of supported input modes. Now you can interact with the desktop and manage it in the same way as on a PC.

Package Manager to install

Package Manager to install




In the Android VNC application, a single tap means left click. Double-clicking simulates a right-click. The application displays three buttons: two for zooming in and out, and one for displaying a virtual keyboard. You can use the package manager to install new applications. The distribution will be able to install applications that have been ported for the ARM architecture, which is true for any popular application.

You can use the steps above to download, configure, and use any of the supported distributions on the device. The application also offers some other options for further configuration of distributions and user interface. First, change the distribution settings the first time you log into it. To do this, select the distribution that you want to configure from the drop-down list in the "Startup" section.

In addition to the “Start Linux” button, click “Configure Linux” to open the settings page. Checkboxes are placed here to enable or disable the launch of SSH and VNC servers. And you can also change the resolution of the VNC screen by changing the values ​​indicated on this page. The page provides several interesting options, including the Create 1GB SWAP File check box. With their help, the application will create a page file for the distribution.

System page file

Before enabling this option, you need to make sure that there is enough free space on the SD card. The application can also connect folders from the Android file system to running Linux.

The order of operations:

  1. Click the Configure Mounts button to start the mount editor.
  2. Click “Options” in the upper right corner, and then select the “Add Mount” option.
  3. A page will appear where you will need to specify the location of the Android folder that needs to be manually divided, for example, storage / sdcard0 / Downloads, and then the installation path, for example, home / ubunt / Download.
  4. You can add as many folders as needed.
  5. Click the “Save Changes” button, then exit the mount editor.

Move folders to a new image

Depending on how the distribution is used, sooner or later the user may run out of free space. In this case, he will have to free up space by creating a larger image and copying all the files and folders from the existing to the new. Start the procedure by starting the terminal and creating an empty image of the required size. For example, to create a 4GB image called ubuntuNEW.img, you need to specify the command:

dd if = / dev / zero of = ubuntuNEW.img bs = 1M count = 0 seek = 4096.

Then you need to format this new image and create a file system using the command:

mke2fs -F ubuntuNEW.img.

Then they copy the image file that must be received from the device to the computer, for example, with the name ubuntuOLD.img. Next, create two folders on the desktop (ubuntuNEW and ubuntuOLD) to mount these images using the commands:

  • sudo mount -o loop ubuntuOLD.img ubuntuOLD;
  • sudo mount -o loop ubuntuNEW.img ubuntuNEW.

They will mount the images in the appropriate folders. Once this is done, copy all the files from the old image to the new image using the command:

sudo cp -rp ubuntuOLD / * ubuntuNEW.

First you need to make sure that the files and folders are copied along with the access rights. The process is usually completed by disabling the image using the entries:

  • sudo umount ubuntuOLD;
  • sudo umount ubuntuNEW.

Now you can transfer the ubuntuNEW.img file to your phone, delete the existing image and make sure that the distro entry on the startup screen points to the new image. Enable the distribution package CLI package manager tools using GNURoot.

Installing Linux on Android without root rights

Installing Linux on Android without root rights




Installing a Linux distribution on an Android phone usually requires the distribution and root permissions supported by ARM. Since rooting a phone voids the warranty and opens backdoors for potential attacks, you need to use the Linux launch method on Android without rooting. With GNURoot, the user does not need to perform these tricks and bypass root privileges.

This method is not like installing the full Linux PC version on Android phones, because they install the Linux subsystem, which includes many tools. You can use apt-get, SSH, or even turn your Android phone into a LAMP server to run web applications.

Installing Linux on an Android phone using this version will require installing GNURoot from the Play Store first. The application then installs the fake Linux root file system. To do this, simply open the Play Store, find GN, URoot and install these products. Choose a Linux distribution helper application.

By default, GNURoot offers various ARM-based Linux distributions: Linux Debian Wheezy, Fedora, Aboriginal (an easy version of BusyBox), and Gentoo. Select any of them and click “Create New Rootfs” to download the necessary files. This process may take some time, so you need to wait a few minutes, after which you should select the Linux distribution and run it.

After the download is complete, select this distribution from the second option of the drop-down list. After the “Run as fake Rootfs” box is checked, apt-get commands and other root commands are received. Click “Run Rootfs” to install and use Linux on the Android phone. Linux Android. , apt-get Wheezy yum Fedora.

«+». , . Linux, GNURoot, . , , .

GNURoot WheezyX, VNC-. VNC Viewer Play . , WheezyX , VNC «localhost: 1» «» . xterm Wheezy. , , Linux Android.




All Articles