π Complete development environment setup for Android 16 Terminal - SSH server, Kubernetes (Minikube), and ArgoCD in the native Debian container environment.
Note: This is specifically designed for the Android Terminal feature in Android 16+, which provides a native Debian container environment. This is NOT for Termux, UserLAnd, or other third-party terminal solutions.
- π Secure by default - Random password generation, hardened SSH configuration
- π‘οΈ Production-ready - Declarative configuration management with Ansible
- π± Android optimized - Designed specifically for Android Terminal
- π§ Flexible deployment - Works with or without systemd
- π― Idempotent operations - Safe to run multiple times
- β‘ Smart caching - Skips installation if Ansible is already available
- π³ Docker support - Full Docker installation and configuration
- βΈοΈ Kubernetes ready - Minikube cluster with essential addons
- π ArgoCD included - GitOps deployment platform ready to use
apt-get update -y && apt-get install -y curl
bash <(curl -s https://raw.githubusercontent.com/MichalTorma/android-terminal-setup/main/install-ansible.sh)git clone https://github.com/MichalTorma/android-terminal-setup.git
cd android-terminal-setup
sudo bash install-ansible.sh- Android 16+ with Android Terminal feature enabled
- Root access (sudo) within the Android Terminal
- Internet connection for package installation
What is Android Terminal?
Android Terminal is a native feature in Android 16+ that provides a full Debian container environment directly on your Android device. It's built into the Android system and provides a genuine Linux environment with full package management capabilities.
- OpenSSH server on port 2222
- Ansible (configuration management)
- Docker (container runtime)
- Kubectl (Kubernetes CLI)
- Minikube (local Kubernetes cluster)
- ArgoCD (GitOps deployment platform)
- Secure configuration with hardened SSH settings
- Random password (12 characters) generated automatically
- Startup script for easy management
- Systemd service (if available)
- Comprehensive logging
SSH runs on port 2222 by default. Set up port forwarding to access from outside:
# ADB port forwarding (recommended)
adb forward tcp:2222 tcp:2222
# Connect from your computer
ssh root@localhost -p 2222Why port forwarding?
Android Terminal runs in a virtualized environment with its own network interface (e.g., enp0s8 with IP 10.135.204.118). While this interface may be accessible from the Android host, port forwarding ensures reliable external access and handles any network isolation between the virtual environment and your Android device's network interfaces.
# Interactive mode
/usr/local/bin/start-ssh.sh
# Background mode
nohup /usr/local/bin/start-ssh.sh > /var/log/ssh.log 2>&1 &
# Using systemd (if available)
sudo systemctl start android-ssh
sudo systemctl enable android-ssh# Basic connection
ssh root@<android-ip> -p 2222
# With verbose output
ssh -v root@<android-ip> -p 2222# Check if SSH is running
ps aux | grep sshd
# View SSH logs
tail -f /var/log/ssh.log
# Check service status (if using systemd)
sudo systemctl status android-ssh# Check cluster status
kubectl cluster-info
# View all pods
kubectl get pods --all-namespaces
# Access Minikube dashboard
minikube dashboard
# Check Minikube status
minikube status# Port forward ArgoCD server
kubectl port-forward -n argocd svc/argocd-server 8080:443
# Get ArgoCD admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -dArgoCD Web UI: https://localhost:8080
- Username: admin
- Password: (generated during installation)
- SSH config:
/etc/ssh/sshd_config - Startup script:
/usr/local/bin/start-ssh.sh - Log file:
/var/log/ssh.log - Systemd service:
/etc/systemd/system/android-ssh.service
# Edit SSH config
sudo nano /etc/ssh/sshd_config
# Restart SSH server
sudo pkill sshd
/usr/local/bin/start-ssh.shSSH connection refused
# Check if SSH is running
ps aux | grep sshd
# Check SSH logs
tail -f /var/log/ssh.log
# Verify port is listening
netstat -tlnp | grep :2222Port forwarding issues
# Test local connection first
ssh root@localhost -p 2222
# Check ADB port forwarding
adb forward --list
# Check network interfaces
ip addr show
# Verify container vs host networking
# Container IP (internal): Usually 10.x.x.x (like 10.135.204.118)
# Host IP (external): Usually 192.168.x.x (WiFi/hotspot)
# If direct connection times out, use port forwarding:
adb forward tcp:2222 tcp:2222
ssh root@localhost -p 2222"externally-managed-environment" error
# The installer handles this automatically, but if installing manually:
pip3 install --break-system-packages ansible
# or
apt-get install -y ansibleDirect connection timeout
# If ssh root@10.135.204.118 -p 2222 times out:
# This is normal - the virtual network is isolated
# Solution: Use port forwarding instead
adb forward tcp:2222 tcp:2222
ssh root@localhost -p 2222
# Alternative: Check if SSH is running locally first
ssh root@localhost -p 2222 # Should work from within Android Terminal# Safe to run multiple times (idempotent)
ansible-playbook -i inventory.ini ansible-playbook.yml -vsudo apt-get update && sudo apt-get upgrade openssh-server- Change the default password immediately after first login
- Use SSH keys instead of passwords for better security
- Keep the system updated regularly
- Monitor logs for suspicious activity
If you encounter issues:
- Check the troubleshooting section
- Review SSH logs:
tail -f /var/log/ssh.log - Open an issue on GitHub with detailed information
This project is open source and available under the MIT License.
Made with β€οΈ for the Android developer community