Steps to install Linux Deploy and have a web server on your mobile phone

  • Linux can run on Android via chroot or PROot, with or without root, using apps like Linux Deploy, UserLAnd or Andronix.
  • Linux Deploy allows you to install complete distributions with a graphical interface and configure startup scripts for services like Apache or MySQL.
  • To use your mobile phone as a stable server, it's key to adjust the screen, CPU, and WiFi, as well as choosing lightweight distributions and desktops.
  • An Android device running Linux can function as a mini web server, development environment, or portable security testing platform.

Steps to install Linux Deploy and have a web server on your mobile phone

Do you want to turn your Android phone into more than just a simple telephone? Full of the same old apps? Today's smartphones have more than enough power to run a complete GNU/Linux system, with a graphical desktop, network services, and even a web server that you can use at home or at work. With the right tools, your phone can end up being a portable mini-server or a small pocket PC.

The key is to combine Android, Linux, and a few specific applications effectively.Linux Deploy, Termux, UserLAnd, Andronix, VNC, XServer, etc. Some require root access and others don't, but they all aim for the same thing: running a Linux distribution in the Android user space without overloading the system and keeping your data safe. Let's see, step by step and in detail, how to install Linux on your mobile device and how to make it work as a web server, and even with a desktop environment.

Why install Linux on your Android phone?

Android is great for everyday use, but it falls short when you want a complete Linux environment. For using development tools, setting up servers, or simply tinkering with a desktop system. If you have an old mobile phone or tablet lying around, installing a Linux distribution can give it a very interesting second life.

The most common motivations for installing Linux within Android They usually revolve around tasks that Google's system doesn't cover well: running specific GNU/Linux software, testing network services, experimenting with lightweight desktop environments, or creating a small security testing lab in your pocket.

Using Android as a base and Linux as a guest system allows you to have the best of both worlds.You still have your usual apps, notifications and mobile connectivity, but at the same time you enjoy a Linux terminal, a remote graphical environment and services like Apache, Nginx, MySQL or SSH running inside the phone.

Furthermore, there's the learning you gain from setting up and maintaining a distro on a mobile device. It's fantastic if you're studying systems administration, development, or security. It's a relatively secure environment: if you mess things up inside the chroot/proot, Android remains intact.

Another advantage is that many of these solutions work without root access.Thanks to technologies like PROoot, which mimics chroot behavior in user space, you can "simulate" a Linux file tree and a fairly complete environment without having administrator privileges on the device.

Can your Android run Linux decently?

In practice, almost any modern Android device can run some form of Linux.However, the experience will depend on RAM, storage, and whether or not you have root access. Even older phones can usually handle lightweight distributions if you don't expect a full GNOME environment.

The minimum requirements for something reasonably usable as a web server They usually include: a couple of gigabytes of RAM, at least 5 GB of free storage (internal or on a fast microSD card) and a stable WiFi connection to download the distro image and manage the system over the network.

If you intend to use a Linux desktop environment with X11 or WaylandHaving a keyboard and mouse (Bluetooth or OTG) is very useful, and if your phone allows it, video output to a monitor or TV is also helpful. They aren't essential, but they greatly improve the experience compared to just using touchscreens.

Another key decision is whether you want root access or prefer to keep your phone unlocked.With root access you have more control, you can use a true chroot environment, and tools like Linux Deploy with all their features. Without root access you depend on Prooot and emulation layers, but you can still have complete distributions with UserLAnd, Andronix, or AnLinux.

As a general idea, for a lightweight web server, an environment without a graphical interface is sufficient.It will consume fewer resources and the phone will run cooler. For gaming on desktop environments like LXDE or XFCE, it's worth using a slightly more powerful device.

Options for installing Linux without root: PROot to the rescue

Linux on Android without root

If you don't want to get into rooting issues or risk voiding the warrantyThere are several apps that run a Linux distribution in user space using PROoot. Essentially, they emulate what chroot does, but without requiring administrator privileges, so Android remains intact and secure.

The most well-known combination is to use Andronix or AnLinux along with Termux and a VNC viewerTermux provides a powerful terminal and its own repositories, and Andronix/AnLinux takes care of downloading the distro root and generating the startup scripts to set up the Linux environment.

Andronix + Termux + VNC Viewer

Andronix acts as a graphical assistant that guides you in selecting the distro and desktop environment.From its interface, you choose Ubuntu, Debian, Manjaro, Kali, etc., and also desktop environments like XFCE or LXDE. The app generates a Termux-compatible command that automates the entire installation process using PROoot.

The typical installation flow using this combo is usually as follows:: You install Andronix, Termux and a VNC viewer (like VNC Viewer), select the distro in Andronix, copy the command it suggests, paste it into Termux and wait for it to download and unpack the Linux file system.

When it's finished, you configure the VNC access password and screen resolution.You start the graphical server within the Linux session and connect from VNC Viewer to something like localhost: 1What you see on the screen is already a real Linux desktop running inside your mobile phone.

With this method you can use the system both via terminal and graphical environment.It's more than enough for light development tasks, text editing, web server testing, or handling security tools with Kali, without having rooted the phone.

Other apps without root: UserLAND, AnLinux, Debian Noroot…

Besides Andronix, there's a whole ecosystem of apps that use PROot to install complete Linux distributions without needing administrator privileges. Each one has its own focus and features, so it's a good idea to know what each one offers.

UserLAnd is one of the most user-friendly and open-source optionsIt allows you to deploy Debian, Ubuntu, Arch, Kali or Alpine Linux, and offers both desktop sessions (LXDE, XFCE4) and individual application installations (e.g., just Firefox, GIMP, LibreOffice) instead of a complete distro.

Its interface is organized into tabs for Applications, Sessions, and File SystemsIn the first window you choose what to install, in the second you manage active connections, and in the third you view the Linux root directory already created. It's very flexible because it lets you create multiple sessions pointing to the same file system, switching between XSDL, VNC, or SSH as needed.

AnLinux works similarly, but relies heavily on Termux.It generates scripts to install Ubuntu, Debian, Fedora, CentOS, openSUSE, or Kali within a Proot environment. It also offers low-power desktops like XFCE4, MATE, LXQt, or LXDE, ideal for mobile devices with limited RAM.

Debian Noroot, on the other hand, takes a simple approach: it boots a lightweight Debian without root. It runs on Android 4.1 or higher. It's less flexible and its performance isn't spectacular, but in return, the installation is quite straightforward if you just want to play around with Debian without any complications.

How Linux works on Android: chroot, PROot, X, and graphics servers

When we talk about “installing Linux on Android” we are really talking about running a Linux environment within Android itselfThese tools don't replace the entire operating system (that would be a different topic: ROMs, bootloaders, etc.). What they do is create a file system for the distro and run it as a normal user.

In rooted environments, chroot is often used, a well-known tool in Linux servers and desktops.`chroot` changes the apparent root directory of a process and its children, so that they only see the file tree of the guest distribution. This requires root permissions, which are not granted by default on Android.

PROot comes to solve that problem when root is not availableIt simulates some of the behavior of chroot in user space, creating a directory "affinity" and translating system calls to make it seem as if the process is locked in the distro's root, even though it is actually still running as a normal Android user.

The next challenge is the graphics: the Linux desktop needs an X server or WaylandIf we simply installed X within the distro and ran it as a normal user, that graphical server wouldn't have direct access to the Android hardware. That's why two different strategies are used.

The first solution is to boot an X server or a graphical environment within the distro and access it via VNCThe VNC server runs on Linux, but the viewer functions as a regular Android app, displaying the remote session that is actually on the device itself (local host). It's simple and fairly compatible, although it doesn't always offer the best performance.

The second way is to use a graphical server designed specifically for Android., such as XServer XSDL. In this case, the X server runs as an Android app, with direct access to the graphics hardware, and the Linux distribution connects to it as a client. It's a slightly more elaborate solution, but it can be more refined than using only VNC.

Install Linux on Android with root using Linux Deploy

When you have a rooted device, it opens the door to much more powerful tools.And this is where Linux Deploy comes in. This application uses chroot with the help of BusyBox and can install Debian, Ubuntu, Arch, Fedora, and many other distributions directly onto the phone's storage.

Linux Deploy has been refined over timeInitially, its documentation was quite limited, but now it offers a reasonably clear interface, profiles for various distributions, and options to enable or disable a graphical interface, file system type, custom scripts, automatic startup, etc.

Basic requirements to use Linux Deploy

Before you get involved with Linux Deploy, make sure you meet these minimum requirements.: the mobile must be rooted, it is advisable to have a current version of BusyBox installed (to have most of the basic GNU utilities) and you need a VNC viewer, for example VNC Viewer, which is free and well rated.

Regarding Android compatibility, Linux Deploy states support from Android 2.3.3 onwards.But realistically, it's unlikely that such old hardware will smoothly run a full desktop environment. For anything even remotely usable, a more modern device with sufficient RAM and storage is better.

You will also need to reserve several gigabytes of space for the system image.In practice, more than 5 GB of free internal memory is recommended, or, if you prefer, a microSD card of at least class 10 with that capacity, if you are going to store the distro there so as not to fill up the internal memory.

Another important requirement is having a good internet connection or a generous data planbecause you will download the ARM image of the distribution you are interested in (Ubuntu, Debian, Kali, etc.) and they are usually packages of several gigabytes including base system, graphical environment and additional packages.

Configuring Linux Deploy: distribution, storage, and GUI

Once the app is installed, Linux Deploy displays a main screen with Start/Stop buttons and a settings icon in the bottom right that gives access to the installation properties. That's the key section for defining which Linux distribution you're going to install and how.

In the properties you can choose the layout (Debian, Ubuntu, Arch, Fedora, etc.), the architecture type (arm, arm64, armhf, armel…) and the file system path, both for the download and for the final image file. It is vital to select the correct architecture that matches your processor to avoid errors.

The installation type is usually set to “file”This means the Linux system will reside within a single image file in EXT2, EXT4, or other format. For most users, this is the simplest option compared to installing on a separate partition.

Below you can choose the file system (default EXT2)(which usually works well) and specify whether you want to store the image in internal memory or on the SD card. If the SD card is fast, it's a good way to avoid filling up the main storage.

In the GUI section you can enable or disable the graphical interface.By selecting this option, Linux Deploy will prepare a desktop environment and configure graphical access, which is usually done via VNC. Here you also select which desktop environment to install (LXDE, XFCE, etc.), your username, and password.

Install and boot the distro with Linux Deploy

Once you have the configuration to your liking, the next step is to launch the installation.Returning to the Linux Deploy main screen, in the menu at the top right you will find the "Install" option, which will trigger the process of downloading and configuring the distribution image.

The time this step takes depends a lot on the speed of your connection and the device's processing power, but it's not uncommon for it to take 30 minutes or more. During that time, the base image is downloaded, unpacked, and the chroot environment is configured with the selected packages.

When the process is complete, all that remains is to start the system. From the Start button at the bottom. Linux Deploy will mount the image, start the necessary services, and, if you have configured the GUI with VNC, launch the graphical server inside the chroot.

To access the desktop, use the VNC viewer you have installed., entering as the address the IP and port shown by Linux Deploy on its main screen (for example, localhost: 5900 or an IP address from your WiFi network). After entering the VNC password defined earlier, the full Linux desktop should appear on your mobile device.

Web servers and other services within the mobile Linux

With the distro now up and running, you can install services just like you would on any Linux server.Using apt, pacman or the distro's tool, you add Apache or Nginx, databases like MySQL/MariaDB, FTP servers, Samba, etc., and manage them with the same old commands.

For a typical web server running Debian or Ubuntu, simply install the appropriate metapackage. (for example apache2 o ) and launch the services with the command Service or with systemctl, depending on how the environment is configured in the Linux Deploy chroot.

Commands like `service apache2 start`, `service apache2 stop` or similar They normally work to start and stop daemons, provided the boot system has been properly configured within the chroot environment.

The important detail is that, upon restarting the Linux environment or the phone itselfSometimes services don't start automatically, even though they are theoretically enabled. Tools such as rcconf They may show that the service is marked to start, but in practice it does not run on chroot boot.

Linux Deploy solves this by allowing you to define “Custom Scripts”In the properties menu there is an option to enable custom scripts and a list where you can add the paths to the startup scripts you want to run automatically (for example, those for MySQL, Apache or cron).

Configuring boot scripts in Linux Deploy

Within the properties screen you will find the “Custom Scripts” sectionActivating it enables a list where you can add, edit, or delete paths to scripts that will run when the Linux environment starts.

For example, you can add the routes to the Apache, MySQL, and cron startup scripts. so that they start whenever Linux Deploy boots the distribution. Each item in the list points to an existing script within the distro's file system.

This replaces the classic method of relying solely on rcconf or the links in /etc/rc*.dwhich sometimes don't function as expected within the application-managed chroot environment. Custom scripts ensure that your critical services always start at boot.

This way you can leave your phone connected via WiFi with its web server running., without having to connect via terminal each time to launch the services manually, which is essential if you want to use it as a small home or laboratory server.

Desktop options: X11, VNC, XServer XSDL and performance

If in addition to a web server you want a manageable desktop environmentYou can choose between two main models: a desktop accessible via VNC or a desktop supported by a native Android X server, such as XServer XSDL. Both have their pros and cons.

With VNC, the most common approach is to start a graphical server within the distro and connect from a VNC viewer. on Android. It's a simple solution, especially if you already use VNC to remotely control other devices, and it allows you to reuse the same app to access the phone's local host.

Some users, however, report performance or compatibility issues with certain VNC viewers.especially on less powerful devices or those with very high resolutions. In those cases, the experience can be somewhat clunky and with a slight delay in the taps.

The alternative is to use an X server adapted for Android, such as XServer XSDL.It involves installing the XServer app on the main system, giving it hardware access permissions, and then having the Linux distro connect to that server as if it were a normal X server.

The typical workflow with UserLAnd and XServer XSDL is: you install the distro, log in via terminal and set up a lightweight desktop (for example, LXDE). with sudo apt install lxde), then you adjust the file .xinitrc so that it launches /usr/bin/startlxde instead of the default window manager, and restart the graphical session.

Once XSDL is running and the Linux session is set up, the complete LXDE desktop appears on the screen.From there you can change font sizes, install your usual programs (Emacs, Firefox, GIMP, LibreOffice…) and use the system almost like a PC, only inside your mobile phone.

Android and Linux Deploy settings to use your mobile phone as a server

To ensure your Linux server set up with Linux Deploy is truly usable in the long termIt's important to adjust some settings both within the app itself and in Android. Otherwise, the system may become very slow or disconnect when the screen is turned off.

On the Linux Deploy configuration screen (accessible from the menu key or the corresponding icon) You'll find general app settings, separate from the distro's properties. These include language, light/dark theme, and screen and Wi-Fi behavior.

By default, Linux Deploy usually enables an option to keep the screen on while the Linux system is running.In Spanish, this is usually called something like "screen lock." This prevents Android from turning off the screen and, therefore, from the processor entering power-saving mode.

If you disable that option, the screen will turn off just like in any other app.However, many devices then send the processor into aggressive "sleep" mode, which leaves the chroot Linux running extremely slowly, because Android puts almost everything in the background except for notifications and basic tasks.

For a web server that should run 24/7, having the screen on all the time is not viable. (due to power consumption, heat, and wear). Ideally, you should uncheck "screen lock" and find an alternative way to prevent the processor from going into too much sleep.

Keep the processor awake and WiFi active

A common trick is to use "cafeteria" or "stay awake" type apps that keep the CPU active even when the screen is off. One of those mentioned is “RedEye Stay Awake”, which in its free version with some advertising prevents the processor from entering deep sleep.

With an app like this, you can let Android turn off the screen without any problems.But keeping Linux services functional and with acceptable performance, which is essential if you want the server to respond smoothly to web requests or SSH connections.

In parallel, in the Linux Deploy configuration, it is advisable to leave the "Block Wi-Fi" option checked. or equivalent, so that the device doesn't disconnect the wireless connection after a few minutes with the screen off. If the Wi-Fi connection drops, your server disappears from the network.

Activating “Auto Start” is also highly recommended. in Linux Deploy, so that every time you restart your phone, the app automatically starts the Linux environment and, with it, the custom scripts that start your services.

Combining WiFi blocking, auto-boot, and an app to keep the CPU awakeYou get your mobile phone to behave almost like a conventional Linux server, accessible through the local network and with services running constantly.

Recommended distributions and environments for mobile devices

Learn Termux commands on Android

The choice of distro greatly influences the stability and performance of the system.The apps discussed usually support a good collection of systems: Ubuntu, Debian, Arch, Fedora, Kali, Alpine, Manjaro and derivative variants.

Ubuntu and Debian are the most popular and user-friendly options.They have large repositories, extensive documentation, and good integration with tools like Apache, Nginx, MariaDB, PHP, Python, Node.js, etc. For a home web server, it's more than enough.

Kali Linux is geared towards security testing and ethical hackingSo it might be interesting if you want to set up a homemade "Pwn Phone", with a good assortment of auditing tools right in your pocket, although it does require a bit more skill.

Arch Linux and Manjaro are geared towards more advanced users Those who want a highly customizable, rolling-release system with direct access to the latest packages. Fedora also fits the profile of a modern distro, although it doesn't always appear in all non-root apps.

For devices with little RAM or limited hardware, Alpine Linux is a very lightweight option.Since it's designed for minimal environments and containers, with the right combination of packages you can set up a very efficient web server with few resources.

As for the desktop environment, it's preferable to choose lightweight environments such as LXDE, XFCE, LXQt, or MATE. Instead of full GNOME or KDE environments, which consume significantly more memory and CPU, the simple and fast interface is a welcome change, especially on small screens and when using VNC.

What can you do with Linux on your mobile phone beyond a web server?

Although we have focused here on setting up a web server, having Linux on your mobile phone opens up many more possibilities.You can set up a file server (Samba, NFS), a database server, or even lightweight containers if the distro allows it.

Having Git, Python, Node.js, and complete compilers and editors as a development environment is very convenient. like Vim or Emacs, all running directly on the phone and accessible via SSH from your laptop or even another mobile device.

If you're a security enthusiast, Kali or other distros with pentesting tools are a good option. They allow you to perform controlled tests in laboratory networks, always within the bounds of legality. The mobile phone literally becomes a portable auditing platform.

You can also turn the device into a small media center with VLC, audio players or even Kodi-type solutions, although here Android itself comes into play more than the Linux environment, depending on how you want to play the content.

Thanks to the portable nature of mobile phones, many of these solutions support remote connections via SSH or VNC.You can leave your phone connected at home and access your Linux environment from any other computer on the network, as if it were a very compact Raspberry Pi.

In short, transform your Android device into a mini Linux server or a remote desktop. It's a great way to get the most out of a device you might have forgotten about in a drawer. With Linux Deploy, UserLAnd, Andronix, and similar programs, the process is much more accessible than it was a few years ago, and with a few fine-tuning adjustments to the configuration, you can create a surprisingly capable web server on something as small as your mobile phone.

Ultra-low data mode on your mobile
Related article:
Turn your mobile phone into a local server for web testing and much more

You might be interested in:
How to remove viruses on Android
Follow us on Google News