Skip to content

Dev Environment ‐ Set up on Phone

Full Stack edited this page Mar 23, 2025 · 10 revisions

Installation steps

  • Update termux: apt-get update && apt-get upgrade -y
  • Install wget: apt-get install wget -y
  • Install proot: apt-get install proot -y
  • Install git: apt-get install git -y
  • Go to HOME folder: cd ~
  • Download script: git clone https://github.com/MFDGaming/ubuntu-in-termux.git
  • Go to script folder: cd ubuntu-in-termux
  • Give execution permission: chmod +x ubuntu.sh
  • Run the script: ./ubuntu.sh -y
  • Now just start ubuntu: ./startubuntu.sh

To Check Ubuntu Version

lsb_release -a

Docker in Ubuntu Via Termux

Installing Docker on Ubuntu is straightforward. Follow these steps:

If you want a stable Linux distro for development on your Samsung Galaxy S23 Ultra, your best options depend on whether you want a chroot/proot-based environment (non-root) or a full Linux installation (rooted).


🔹 Best Linux Distros for Development on S23 Ultra

Distro Stability Performance Root Required? Package Support Recommended For
Ubuntu (via Andronix or UserLAnd) ⭐⭐⭐⭐ Good ❌ No APT, Snap General development (Python, Web, Node.js, etc.)
Debian (via Proot-Distro in Termux) ⭐⭐⭐⭐ Good ❌ No APT Stability-focused development
Alpine Linux (via Termux Alpine) ⭐⭐⭐⭐⭐ Excellent ❌ No APK (lightweight) Lightweight development
Arch Linux (via Andronix) ⭐⭐⭐ High ❌ No Pacman Latest software, rolling release
PostmarketOS (Rooted Install) ⭐⭐⭐⭐⭐ Excellent ✅ Yes APT Native Linux replacement for One UI
Manjaro ARM (Rooted Install) ⭐⭐⭐⭐ High ✅ Yes Pacman Best for a full Linux desktop on DeX
Using PodMan or QEMU (Full VM)

Since Termux does not support systemd or cgroups, running Docker directly inside Termux will not work as expected. However, you can try an alternative approach using Podman or Rootful Docker with QEMU.


Alternative 1: Use Podman (Docker Alternative)

Podman is a container engine similar to Docker but does not require systemd or root privileges.

Step 1: Install Podman

pkg update && pkg upgrade -y
pkg install podman -y

Step 2: Verify Podman Installation

podman --version

Step 3: Run a Test Container

podman run hello-world

Podman provides almost full Docker compatibility.


Alternative 2: Run Docker Using QEMU (Full VM)

If you absolutely need Docker, running a lightweight Ubuntu VM inside Termux using QEMU is the best approach.

Step 1: Install QEMU in Termux

pkg install qemu-utils qemu-common qemu-system-x86-64 -y

Step 2: Download and Set Up Ubuntu Image

mkdir ~/ubuntu
cd ~/ubuntu
curl -O https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img

Step 3: Run Ubuntu VM

qemu-system-x86_64 -m 2048 -smp 2 -drive file=jammy-server-cloudimg-amd64.img,format=qcow2 -net nic -net user,hostfwd=tcp::2222-:22 -nographic

This will start an Ubuntu VM inside Termux.

Step 4: SSH into Ubuntu VM

Open a new Termux session and connect:

ssh -p 2222 ubuntu@localhost

Step 5: Install Docker in Ubuntu VM

Inside the VM, install Docker as usual:

sudo apt update && sudo apt install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker

Now you can run Docker containers normally.


Conclusion

Since Termux lacks systemd and cgroups, running Docker natively is not possible. The best alternatives are:

  1. Use Podman (lightweight and systemd-free).
  2. Run a QEMU-based Ubuntu VM to fully support Docker.

Would you like help setting up a specific use case for containers in Termux? 🚀


Option1-using proot Termux does not use **systemd** as its init system, which is required to run Docker in a standard way. However, you can still run Docker inside Termux using **PRoot** (a user-space implementation of chroot) to simulate a Linux environment.

Solution: Install Docker Using PRoot on Termux

Step 1: Install Termux Packages

First, update and install required dependencies:

pkg update && pkg upgrade -y
pkg install proot-distro -y

Step 2: Install Ubuntu in Termux

Use proot-distro to install Ubuntu:

proot-distro install ubuntu

After installation, start the Ubuntu environment:

proot-distro login ubuntu

Step 3: Install Docker Inside Ubuntu PRoot

Once inside Ubuntu, install Docker using the standard commands:

apt update && apt upgrade -y
apt install -y docker.io

Step 4: Start Docker Without systemd

Since Termux doesn’t use systemd, manually start the Docker daemon:

dockerd --host=unix:///data/data/com.termux/files/usr/var/run/docker.sock

Step 5: Test Docker

Open a new Termux session, enter Ubuntu (proot-distro login ubuntu), and run:

docker --version
docker run hello-world

Limitations

  • Docker-in-Termux is limited because it cannot use kernel features like cgroups.
  • You might face performance issues due to PRoot overhead.
  • Rootless Docker is experimental in this setup.

For full Docker support, it's recommended to use a real Linux environment (like Ubuntu in a VM or WSL on Windows). Let me know if you need more help! 🚀

Option2 - normal ubunty - not working

Step 1: Update Package List

Open a terminal and run:

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

Install necessary packages:

sudo apt install -y ca-certificates curl gnupg

Step 3: Add Docker’s GPG Key

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc

Step 4: Add the Docker Repository

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update

without sudo

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update

Step 5: Install Docker

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

without sudo

apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step 6: Start and Enable Docker

sudo systemctl enable --now docker

without sudo

systemctl enable --now docker

Step 7: Verify Installation

docker --version
sudo docker run hello-world

without sudo

docker --version
docker run hello-world

Step 8 (Optional): Run Docker Without sudo

Add your user to the docker group:

sudo usermod -aG docker $USER
newgrp docker
docker run hello-world  # Test without sudo

Install n8n

Setting Up n8n in Podman (Docker Alternative) on Termux

Since n8n (an automation workflow tool) provides a Docker image, we can run it using Podman in Termux.


🔹 Step 1: Install Podman

First, make sure Podman is installed in Termux:

pkg update && pkg upgrade -y
pkg install podman -y

Verify the installation:

podman --version

🔹 Step 2: Pull the n8n Docker Image

Run the following command to pull the official n8n image:

podman pull docker.io/n8nio/n8n

🔹 Step 3: Create a Volume for n8n Data (Optional)

To persist your workflows and settings, create a storage volume:

mkdir -p $HOME/n8n-data

🔹 Step 4: Run n8n Container

Start n8n using Podman:

podman run -d --name n8n \
  -p 5678:5678 \
  -v $HOME/n8n-data:/home/node/.n8n \
  docker.io/n8nio/n8n

🔹 Explanation:

  • -d → Run in detached mode.
  • --name n8n → Name the container "n8n".
  • -p 5678:5678 → Expose n8n on port 5678.
  • -v $HOME/n8n-data:/home/node/.n8n → Persist data.

🔹 Step 5: Verify the Container is Running

Check running containers:

podman ps

If it's running, you should see n8n in the list.

To view logs:

podman logs -f n8n

🔹 Step 6: Access n8n Web Interface

Now, open Termux's local browser and go to:

http://localhost:5678

Or, if accessing from another device on the same network, use:

http://<your-device-ip>:5678

Find your local IP using:

ip a | grep wlan0

🔹 Step 7: Manage n8n Container

Stop n8n:

podman stop n8n

Restart n8n:

podman start n8n

Remove n8n:

podman rm -f n8n

🚀 Done! n8n is Running in Podman on Termux

Let me know if you need additional setup, like database integration (PostgreSQL) or custom environment variables! 🎯


References

Clone this wiki locally