As a web developer, being able to run a Linux distro alongside your pre-existing mobile OS on your android phone is a very enticing offer. With a fully functional Linux program in your pocket at all times, you can begin to utilize your phone for various processes including powering a LAMP server and turning the device into a portable network, troubleshooting tool, and pen-testing device.
Furthermore, by utilizing LinuxOnAndroid’s shell scripts and Android app, as well as the open source app, Linux Deploy, you can host multiple Linux distros and boost them using the app, as well as install Linux on your rooted android device. From there, the scripts mount the Linux image within the Android filesystem and the SD card within the Linux filesystem.
Although more advanced Android devices may include the Samsung KNOX counter (leading to a warranty breach if you root the device), there is actually a way to install Linux on an Android phone without rooting. However, you can still utilize Samsung Kies or ODIN to flash a stock ROM, and not flag or trip the KNOX counter as well and, once the device is rooted, you can always ODIN back to stock to claim the warranty, as long as you do not encounter hardware failure before then.
In order to open up a shell for you to connect to the mounted Linux system, the scripts then change the root directory to the mounted Linux system by calling on chroot. After this is complete, they set up the cryptographic network protocol, SSH, in order to operate the network services securely over the unsecured network supplied to us by the Android phone. In doing so, it ensures that, despite installing Linux on a weak security device, you will not be breached or intruded upon during use.
Furthermore, the scripts set up VNC so you can use Remote Frame Buffer Protocol (RFB) to relay the graphical screen on Linux’s desktop for efficiency. Although these scripts simply set up the environment in which Linux will run on the device, the multiple Linux distros on the device are actually made up of ARM packages. This means that, instead of being forced to run on a virtual machine, the smaller-sized processor (as well as its ability to reduce complexity and lower power consumption) allows the ARM processor to run the distros on hardware on your Android phone instead.
By using Chroot, you can create an isolated environment, which does not interfere with the rest of the system and use the Linux Deploy app to install and run Linux on your device via a user-friendly interface provided by the app itself. However, before tackling the Linux installation, you must first install a VNC client as well as a terminal emulator so you can receive the graphical screen of the Linux desktop and access the Linux command line shell. Although there are several VNC and terminal emulator apps, VX ConnectBot and MultiVNC are both free apps that are extremely effective for this procedure likewise.
Installing Linux Distros Using Linux Deploy
First, you will need to open the Linux Deploy app and click on the Properties button. In the Properties window, there is a list of configurable options and this is where you can choose the desired Linux distros from the Distribution list in the Deploy section. Next, you can choose specific versions of the distros being used in the Distribution Suite list.
Once this is complete, you may want to specify a mirror closer to you as the Linux Deploy app uses a mirror based in Russia, which may not be suitable for you. To do this, edit the Mirror URL setting, pick the mirror closest to you, and enter its URL. For instance, if you are installing Fedora in the United States, you will want to enter a URL such as this one (the closest to myself):
Once this is complete, you can choose how Linux Deploy installs Linux in the Installation Type list and decide whether you want to install it via an image file (most common), a specific folder, or even a separate partition. However, if your Android device does have an SD card slot, you can even install Linux on a storage card or use a partition on the card for that purpose.
Linux Deploy will also allow you to set up your graphical desktop environment as well so head over to the Desktop Environment list and enable the Install GUI option. After this is done, you can enable both the SSH and VNC options to connect to the running Linux instance as well as the desktop environment created by MultiVNC and then determine the color depth, desktop dimensions, and resolution of the VNC client app to improve your desktop view.
Now that you have successfully set up the app’s deployment of Linux, you can click on Install Item button and wait as it installs the configurations you have set up for Linux on your phone. Once it is complete, if done correctly, you will see this status on the screen:
<<< end: install
Now, you can boot the installed Linux distro by clicking on the Start button then launch the VX ConnectBot app using the IP address of the running Linux instance. Once this is complete, you will want to establish an SSH connection to secure your unsecured device by using the IP address of the Linux instance as well as the default android username and enter the default changeme password when you are prompted to do so.
After you have set up the Linux instance, you will definitely want to change the default password by issuing a passwd command and change the user password as well as run sudo passwd root to assign the root password likewise. Lastly, you can connect MultiVNC to the running VNC server by using the default changeme password.
Although this is not the only way to install Linux on your phone, it is an efficient and free process, which increases the actual value of having Linux on your phone significantly. Although the AMR processor allows you to use low-grade phones, you may want to think about using a stronger cell service to boost the speed of the device when running web applications or troubleshooting. For instance, the first time I completed this process on my Samsung Galaxy Avant, I faced a major issue with my current carrier MetroPCS and its inability to run the Linux distros efficiently. However, multiple carriers have far stronger connectivity and would be much more efficient when doing this project. Since then, I have done the same project on an LG G Stylo connected to T-Mobile’s service and the results are much more efficient.
On top of this, with T-Mobile’s 4G-LTE plan turning into a 5G-LTE plan very shortly; this may be a perfect provider when trying to use a complex system such as Linux on an Android device. Furthermore, if you decide to choose a different launching app other than Linux Deploy, you can also utilize LinuxOnAndroid or Limbo PC Emulator, however, the Limbo PC Emulator is not extremely fast and, therefore, you may be better suited using the other 2 instead. Still, Limbo does have a High Priority option, which ultimately speeds up the VM (but may also affect the responsiveness of the Android device) as well as tips on improving specific distros on the project’s site.
Nevertheless, installing Linux on an Android device can help you to turn your simple phone into a highly useful tool for web development, troubleshooting, and various other procedures common in the IT industry. On top of this, using these open source alternatives can also allow you to complete the project without paying a dime and use a simple and easy-to-use interface likewise. In the end, you will ultimately have an entirely new way of using Linux always within reach and ready to go for those difficult situations that require Linux but may be hard to do via a computer.
Whether you are new to Linux or have experience, this cheat sheet can assist you when encountering tasks you haven’t done lately.
So Docker containers are all the rage, right? (If you didn’t know this, you do now.) 🙂 For a while now, Red Hatters have already been doing a ton of upstream container work on Docker, Kubernetes, and a new item called Nulecule. But while Docker containers have skyrocketed in popularity,…
June 23, 2015