OpenCode in Android Termux 260303
Complete Setup Guide: Termux, Ubuntu, OpenCode, and Claude Code
(Featuring the Opencode Isolation & Burner Workflow)
Follow these steps in order to turn your Android tablet into a fully functional development environment.
Safety Note: By using proot-distro (as outlined below), this setup employs the isolation technique referenced in wiki.gi7b.org. This creates a sandboxed Linux environment, ensuring that the AI coding agents are safely contained. With the added "burner workflow," your agents are restricted to a daily isolated workspace, ensuring they cannot damage your Android device or access files outside their designated folder.
Phase 1: Download and Install Termux
Note: Do not use the Google Play Store version.
Open your tablet's browser and go to the official Termux GitHub releases page (Main site repo: Termux GitHub.io or directly to the app releases).
Download the file named: termux-app_v0.118.3+github-debug_arm64-v8a.apk
Tap the downloaded file to install it. If your tablet prompts you for permission to "Install unknown apps," allow it.
Open the Termux app.
Phase 2: Configure Termux & Android Permissions
Once Termux is open, you will see a black terminal screen. Let's get the base system updated and connected to your tablet's storage.
Grant storage access so you can access your tablet's internal files. Run this command and tap "Allow" on the popup:
termux-setup-storage
Update the Termux base system by typing the following and hitting Enter. (If it pauses and asks Y/n, type Y and hit Enter. If it prompts you with a default configuration choice, just hit Enter):
pkg update && pkg upgrade -y
Phase 3: Install and Launch Linux (Ubuntu) - Isolation Step
Now we install proot-distro and employ the Burner Workflow to create a safely isolated daily workspace.
Install proot-distro:
pkg install proot-distro -y
Download and install Ubuntu:
proot-distro install ubuntu
The Isolation Step: Create a daily workspace directory (e.g., workspace260303) and launch Ubuntu so that its home directory points only to this isolated folder. Run the following commands:
Create a date-stamped workspace directory for today
mkdir -p ~/workspace$(date +%y%m%d)
Launch Ubuntu and bind the isolated workspace to the root home directory
proot-distro login ubuntu --bind ~/workspace$(date +%y%m%d):/root
Success! When your prompt changes to root@localhost, you are officially running Ubuntu inside your isolated daily burner workspace.
Phase 4: Prepare Ubuntu & Install AI Coding Agents
Now that you are inside your safely isolated Ubuntu environment, you need to update it and install your coding tools. (Note: Because you are using a daily burner workspace, you will run these installs inside your fresh environment).
Update Ubuntu's package manager:
apt update && apt upgrade -y
Install prerequisite tools (Git and Curl):
apt install git curl -y
Install OpenCode: Run the official installation script for the OpenCode terminal AI agent:
curl -fsSL https://opencode.ai/install | bash
Important: The installer places OpenCode in a local directory that isn't loaded in your current session yet. Reload your environment so your terminal can find the new command:
source ~/.bashrc
Start OpenCode by typing: opencode
Install Claude Code: Anthropic's official CLI coding agent can be installed directly as well:
curl -fsSL https://claude.ai/install.sh | bash
Start Claude Code by typing: claude (You will be prompted to authenticate your account on the first run).
Phase 5: Set Up GitHub and Clone Your Repository
Because you are using the "burner workflow" (where your workspace resets daily), pushing your code to GitHub is the essential way to save your work before logging off.
Create a GitHub Account: Open your tablet's web browser, go to GitHub.com, and sign up for a free account if you don't already have one.
Create a New Repository: Once logged in, click the "+" icon at the top right (or the "New" button) to create a new repository. Give it a name (e.g., my-android-project), choose Public or Private, and check the box to "Add a README file" so you can easily clone it. Click "Create repository".
Configure Git in Ubuntu: Go back to your Termux terminal (where Ubuntu is running) and tell Git who you are:
git config --global user.name "Your GitHub Username"
git config --global user.email "your.email@example.com"
Generate a GitHub Token: Since password authentication is no longer supported on the command line, go to GitHub in your browser, click your profile picture -> Settings -> Developer Settings -> Personal access tokens (Classic). Generate a new token and check the "repo" permissions box. Copy this token.
Clone the Repository: In your Ubuntu terminal, copy the clone URL from your new GitHub repo and run:
git clone https://www.google.com/search?q=https://github.com/YourUsername/my-android-project.git
(When prompted for a password in the terminal, paste the Personal Access Token you just generated).
Phase 6: Code, Commit, and Go Live
This is your core development loop.
Navigate into your project:
cd my-android-project
Work with your AI Agent: Launch your chosen AI assistant directly inside this repository folder to start coding. For example, to use OpenCode:
opencode
(Or type claude to use Claude Code). Ask the AI to build your app, create a website, or write a script. It will read and write files directly in this directory.
Check your changes: Once the AI is done and you exit the agent, verify what files were modified:
git status
Stage and Commit: Save the changes to your local Git history:
git add .
git commit -m "Added features via AI coding agent"
Go Live (Push to GitHub): Send your finished code up to your GitHub repository so it's safely backed up and live!
git push origin main
(Again, use your Personal Access Token if prompted for a password).
Next Day Workflow: Tomorrow, when you generate a new daily burner workspace, simply follow the cloning step (Phase 5, Step 5) to pull down your code and pick up exactly where you left off!