If you are a developer familiar with the Linux environment or a Linux operations engineer, you will find that having a portable Linux workstation is very helpful for your work and study. Have you ever thought about transforming your smartphone, which you carry with you, into a Linux workstation? In this article, I will introduce how to turn an Android phone into a reasonably powerful Linux workstation, combining solutions provided by AI large models and my own practice.
1. Comparison and Selection of Termux and ZeroTermux
Features Termux ZeroTermux
Essence Basic terminal environment and Linux environment Enhanced graphical front-end based on Termux
Advantages Officially maintained, clean, stable One-click installation of Linux, user-friendly interface, built-in web file manager
Disadvantages Requires manual configuration, complex Depends on Termux environment, unofficial version
Recommended Choice Suitable for users learning command line Suitable for users seeking convenience and quick use
Conclusion: For most users, ZeroTermux is a better starting point due to its convenience of “one-click installation”.
2. Usability Analysis of the Older Huawei Phone Nova 9 SE
I have an older Huawei phone with a Qualcomm Snapdragon 680, 8GB RAM, and 128GB storage. This configuration fully meets the requirements for running Linux on a phone.
· Performance Comparison: Equivalent to an entry-level development laptop, sufficient for learning Linux, programming, and running lightweight services.
· Key Matching: APK files for arm64-v8a architecture match perfectly with the phone’s processor.
3. Correct Installation Steps for ZeroTermux
1. Obtain the installation package:
· [Correction] The only recommended channel: Download from the correct GitHub repository release page: https://github.com/hanxinhao000/ZeroTermux
2. Installation and Authorization:
· After downloading the APK, install it directly, and during the installation process, authorize “Allow apps from this source” as prompted.
· After installation, open the app and be sure to allow it to access “storage” permissions.
4. Installing Ubuntu and Basic Functions in Termux/ZeroTermux
1. Install the Ubuntu system:
· Use the command pkg install proot-distro to install the management tool.
· Use the command proot-distro install ubuntu to install Ubuntu.
· Use the command proot-distro login ubuntu to log into the system.
2. [Key Step] Configure software sources and install basic functions:
· After logging into Ubuntu, the first thing to do is execute apt update to update the software list.
· Common problem resolution: If apt update fails or subsequent packages (like git) cannot be found, it is due to network or software source issues. The solution is to switch to domestic mirror sources (like Tsinghua source, Alibaba Cloud source), specific commands have been provided in previous conversations.
· After successful updates, you can install the basic suite:
apt install git python3 python3-pip nodejs npm build-essential -y
5. Interaction Expansion between Mobile Ubuntu and Computer Ubuntu
Ubuntu on the phone (based on PRoot) can interact with the computer workstation in various ways, forming a lightweight mobile development environment.
1. SSH Remote Connection (Most Recommended):
· Goal: Log directly into the phone’s Ubuntu environment from the computer.
· Steps:
· Install SSH service in phone Ubuntu: apt install openssh-server -y
· Start the SSH service: service ssh start
· Run ifconfig in phone Termux to view the phone’s IP address.
· Ensure the computer and phone are on the same Wi-Fi network.
· Use the terminal on the computer: ssh username@phone_IP_address -p 22 to connect.
2. File Synchronization:
· Use the scp command: Transfer files via SSH protocol from the computer terminal.
· To transfer files from the computer to the phone: scp /path/to/local/file.txt username@phone_IP_address:/path/on/phone/
· To download files from the phone to the computer: scp username@phone_IP_address:/path/on/phone/file.txt ./
3. Code and Version Control:
· Configure Git in phone Ubuntu to push code repositories to platforms like GitHub/Gitee, allowing for pull and collaboration on the computer, and vice versa.
4. Remote Development:
· Install code-server (web version of VS Code) on phone Ubuntu, then access http://phone_IP_address:8080 in the computer browser to get a complete remote programming interface.
Installation Summary: My Huawei Nova 9 SE is a capable device. By correctly installing ZeroTermux or Termux and following the configuration steps, I have successfully created a portable Linux system. Through network services like SSH, it can easily interact with your main computer, greatly expanding its utility.
Using Ubuntu in ZeroTermux
Allowing the Ubuntu environment in ZeroTermux on the phone to access and utilize resources on the computer workstation is also a very practical scenario. Here are solutions specifically for this need:
Core Architecture: Computer as server, phone Ubuntu as client
Solution 1: SSH – Core Control Channel (Essential)
This is the most basic and important connection method, opening the door to your computer.
Enable SSH service on the computer
Ubuntu/Linux Computer:
# Install SSH server (usually pre-installed) sudo apt update && sudo apt install openssh-server -y # Start service sudo systemctl enable ssh && sudo systemctl start ssh # Check status sudo systemctl status ssh
Windows Computer:
· Enable: Settings → Apps → Optional Features → Add Feature → Install OpenSSH Server
· Or run in PowerShell as administrator:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 Start-Service sshd Set-Service -Name sshd -StartupType ‘Automatic’
macOS Computer:
· System Preferences → General → Sharing → Enable Remote Login
Connect to the computer from phone Ubuntu
# Execute in the ZeroTermux Ubuntu environment: apt update && apt install openssh-client -y # Connect to the computer (replace with your computer username and IP) ssh username@computer_IP_address # Example: ssh [email protected]
Find the computer IP:
· Linux/macOS: ip addr show or ifconfig
· Windows: ipconfig
Solution 2: File Resource Sharing
Use SSHFS – Mount remote folders locally
# Install sshfs in phone Ubuntu apt install sshfs -y # Create local mount point mkdir ~/remote_pc # Mount remote folder (enter password after connecting) sshfs username@computer_IP_address:/home/username ~/remote_pc # Now you can access computer files as if they were local files ls ~/remote_pc/ cd ~/remote_pc/Documents
Unmounting the mount:
fusermount -u ~/remote_pc
Solution 3: Remote Development Environment
Use VS Code Remote – SSH
Install VS Code and Remote – SSH extension on the computer
Configure SSH keys in phone Ubuntu (passwordless login):
# Generate key pair in phone Ubuntu ssh-keygen -t rsa -b 4096 -C “phone_ubuntu” # Press enter continuously to use the default path # Copy the public key to the computer ssh-copy-id username@computer_IP_address # Now you can log in without a password ssh username@computer_IP_address
In the computer VS Code, connect to phone Ubuntu via SSH (reverse connection):
· Install Remote – SSH extension
· Add a new SSH target: username@phone_IP_address
· You can now edit code files on the phone from the computer
Solution 4: Database and Server Access
Port Forwarding – Access services on the computer
If the computer is running web servers, databases, etc., you can access them via SSH tunnel:
# Create a tunnel in phone Ubuntu (mapping the computer’s 3306 port to local 33306) ssh -L 33306:localhost:3306 username@computer_IP_address # Then you can connect in phone Ubuntu mysql -h 127.0.0.1 -P 33306 -u username -p
Common service port forwarding:
· Web server: ssh -L 8080:localhost:80 username@computer_IP
· PostgreSQL: ssh -L 5432:localhost:5432 username@computer_IP
· Redis: ssh -L 6379:localhost:6379 username@computer_IP
Solution 5: Using Computer’s Computing Resources
Remote execution of computational tasks
# Write scripts in phone Ubuntu to execute on the computer ssh username@computer_IP_address “python3 /path/to/heavy_computation.py” # Or transfer local files to the computer for execution scp heavy_script.py username@computer_IP_address:/tmp/ ssh username@computer_IP_address “cd /tmp && python3 heavy_script.py”
Network Configuration Key Points
Ensure network connectivity
# Test connection in phone Ubuntu ping computer_IP_address # If ping fails, check: # – Are the computer and phone on the same WiFi? # – Is the computer firewall allowing SSH (default port 22)?
Accessing from external networks (Advanced)
If you need to access your home computer while out, you will need:
· Internal network penetration tools: ZeroTier, Tailscale (recommended, easy to configure)
· Router port forwarding: Forward a public IP port to the computer’s port 22
Complete Workflow Example
Scenario: Developing on the phone, using the computer’s GPU for computation
# 1. Connect to the computer ssh [email protected] # 2. Prepare data on the computer # (Execute in SSH session) cd /projects/ai_model python prepare_data.py # 3. Exit SSH, create a tunnel to access the computer’s Jupyter service # (Open a new terminal in phone Ubuntu) ssh -L 8888:localhost:8888 [email protected] # 4. Access the computer’s Jupyter in the phone browser # Open: http://localhost:8888
Security Recommendations
Use key authentication instead of passwords
Change the default SSH port (e.g., from 22 to another port)
Disable root login
Use strong passwords
Recommended implementation order:
First establish basic SSH connection
Configure SSH key for passwordless login
Try file sharing (SSHFS)
Set up port forwarding based on specific needs
In this way, phone Ubuntu becomes a portable terminal that can fully utilize the powerful resources of the computer.