⚡ TERMUX MASTERY GUIDE v2.0

TERMUX
PRO BEAST

// ANDROID → FULL STACK SERVER + HACKING LAB + AI ENGINE

8 POWER MODULES
100+ COMMANDS
PRODUCTION READY
ETHICAL HACKING
00
🚀 BOOTSTRAP — First Time Setup
// Run this FIRST on any fresh Termux install
⚡ Install Termux from F-Droid (NOT Play Store) for full package support: f-droid.org
bootstrap.sh — Run First
# ═══ STEP 1: Update everything ═══
$ pkg update -y && pkg upgrade -y

# ═══ STEP 2: Core tools ═══
$ pkg install -y git curl wget nano vim zsh bash

# ═══ STEP 3: Allow storage access ═══
$ termux-setup-storage

# ═══ STEP 4: Install Oh My Zsh (pro terminal) ═══
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# ═══ STEP 5: Set Zsh as default shell ═══
$ chsh -s zsh

# ═══ STEP 6: Install essential build tools ═══
$ pkg install -y build-essential make cmake clang

# ═══ STEP 7: Install openssh (use your phone via SSH) ═══
$ pkg install -y openssh && sshd
💡 After bootstrap: type zsh to switch to your new pro shell. Your terminal will look 10x better.
01
🧑‍💻 Full Development Environment
// Python · Node.js · Rust · C · APIs · Backend
dev-environment.sh
── PYTHON FULL STACK ── $ pkg install -y python
$ pip install flask fastapi uvicorn requests httpx pandas numpy sqlalchemy
$ pip install django djangorestframework celery redis

── NODE.JS + JAVASCRIPT ── $ pkg install -y nodejs
$ npm install -g express nodemon pm2 typescript ts-node
$ npm install -g @nestjs/cli create-react-app next

── RUST (blazing fast) ── $ pkg install -y rust
$ rustup component add rustfmt clippy

── C / C++ ── $ pkg install -y clang gcc gdb valgrind

── API TESTING ── $ pkg install -y httpie
$ pip install pytest locust

── RUN A NODE SERVER ── $ mkdir myapp && cd myapp && npm init -y
$ echo "const e=require('express');const a=e();a.get('/',(r,s)=>s.send('🔥 Server running from Android!'));a.listen(3000)" > index.js
$ node index.js

⚡ PM2 Process Manager

  • pm2 start app.js — start app
  • pm2 list — see all processes
  • pm2 logs — live logs
  • pm2 restart app — restart
  • pm2 stop all — stop all

🐍 Quick FastAPI Server

  • pip install fastapi uvicorn
  • Create main.py with @app.get("/")
  • uvicorn main:app --reload
  • Access: localhost:8000
  • Docs: localhost:8000/docs
02
🌐 Web Hosting — Apache / Nginx / PHP
// Host portfolios · dashboards · DVWA · PHP apps
web-server.sh
── NGINX SERVER ── $ pkg install -y nginx
$ nginx # start server on port 8080
$ nginx -s reload # reload config
$ nginx -s stop

── PHP + APACHE ── $ pkg install -y apache2 php php-apache
$ echo "" > $PREFIX/share/apache2/default-site/htdocs/info.php
$ apachectl start

── MARIADB (MySQL) ── $ pkg install -y mariadb
$ mysql_install_db
$ mysqld_safe --datadir=$PREFIX/var/lib/mysql &
$ mysql -u root

── DVWA HACKING LAB ── $ cd $PREFIX/share/apache2/default-site/htdocs
$ git clone https://github.com/digininja/DVWA.git dvwa
$ cp dvwa/config/config.inc.php.dist dvwa/config/config.inc.php
$ nano dvwa/config/config.inc.php # set DB credentials

── NGROK (expose to internet) ── $ pkg install -y tsu
$ wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-arm.tgz
$ tar -xzf ngrok-v3-stable-linux-arm.tgz
$ ./ngrok http 8080 # get public URL!
03
🤖 Automation & Bots — Money Makers
// Telegram bots · Web scrapers · Cron jobs · WhatsApp
automation.sh
── TELEGRAM BOT ── $ pip install python-telegram-bot aiogram requests
# Create bot.py and run it — talk to @BotFather first
$ python bot.py & # run in background

── WEB SCRAPER STACK ── $ pip install scrapy beautifulsoup4 selenium playwright
$ pip install cloudscraper httpx[http2] fake-useragent
$ scrapy startproject mybot

── CRON JOBS (scheduled tasks) ── $ pkg install -y cronie
$ crond # start cron daemon
$ crontab -e
# Add: */30 * * * * python /data/data/bot.py >> /tmp/bot.log 2>&1

── WHATSAPP VIA TWILIO API ── $ pip install twilio flask
# Use Twilio sandbox for free WhatsApp messaging

── TASK SCHEDULER WITH CELERY ── $ pip install celery redis flower
$ pkg install -y redis && redis-server &
$ celery -A tasks worker --loglevel=info
04
🔐 Cybersecurity / Ethical Hacking Lab
// nmap · sqlmap · hydra · netcat · ONLY ON YOUR OWN SYSTEMS
⚠️ ETHICAL USE ONLY. Only scan/test systems you OWN or have written permission for. Unauthorized hacking = crime.
cybersec-lab.sh
── NETWORK TOOLS ── $ pkg install -y nmap netcat-openbsd dnsutils whois
$ pkg install -y ncat ncrack masscan
$ nmap -sV -p 1-1000 localhost # scan localhost
$ nmap -A -T4 192.168.1.1 # your own router

── SQLMAP (SQL injection testing) ── $ pkg install -y python sqlmap
# Test against your DVWA:
$ sqlmap -u "http://localhost/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit" --cookie="PHPSESSID=xxx;security=low" --dbs

── METASPLOIT FRAMEWORK ── $ pkg install -y unstable-repo
$ pkg install -y metasploit
$ msfconsole

── HYDRA (password testing on your own systems) ── $ pkg install -y hydra
$ hydra -l admin -P /usr/share/wordlists/rockyou.txt localhost http-post-form

── WORDLISTS + TOOLS ── $ pkg install -y john hashcat aircrack-ng
$ git clone https://github.com/danielmiessler/SecLists.git ~/wordlists

── NETWORK MONITOR ── $ pkg install -y tcpdump wireshark-cli
$ tcpdump -i any -w capture.pcap
05
🧠 AI / Offline LLM Models
// TinyLlama · Phi-2 · Whisper · Stable Diffusion lite
ai-engine.sh
── OLLAMA (easiest LLM runner) ── $ curl -fsSL https://ollama.ai/install.sh | sh
$ ollama serve &
$ ollama pull tinyllama # 638MB, runs on 2GB RAM
$ ollama pull phi # Microsoft Phi-2, very capable
$ ollama run tinyllama "Write a Python API for me"

── LLAMA.CPP (raw model runner) ── $ git clone https://github.com/ggerganov/llama.cpp && cd llama.cpp
$ make -j4
# Download GGUF model from HuggingFace then:
$ ./main -m models/tinyllama.gguf -p "Hello, how are you?" -n 256

── WHISPER (speech to text) ── $ pip install openai-whisper
$ whisper audio.mp3 --model tiny

── AI PYTHON LIBS ── $ pip install transformers torch sentence-transformers
$ pip install langchain chromadb ollama

── BUILD AI ASSISTANT ── $ pip install ollama rich
# Create assistant.py → use ollama python library → stream responses
🧠 Best models for Android (4GB RAM): TinyLlama-1.1B (Q4), Phi-2 (Q4), Mistral-7B with Q2 quant. Always use GGUF format.
06
🗄️ Database + Backend Systems
// MariaDB · PostgreSQL · Redis · MongoDB · CRM · SaaS
databases.sh
── MARIADB (MySQL) ── $ pkg install -y mariadb
$ mysql_install_db && mysqld_safe &
$ mysql -u root -e "CREATE DATABASE saas_db; CREATE USER 'dev'@'localhost' IDENTIFIED BY 'password123'; GRANT ALL ON saas_db.* TO 'dev'@'localhost';"

── POSTGRESQL ── $ pkg install -y postgresql
$ initdb $PREFIX/var/lib/postgresql
$ pg_ctl -D $PREFIX/var/lib/postgresql start
$ createdb mydb && psql mydb

── REDIS (cache + queues) ── $ pkg install -y redis
$ redis-server &
$ redis-cli ping # should return PONG

── SQLITE (zero config) ── $ pkg install -y sqlite
$ sqlite3 mydb.db "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT);"

── DB MANAGEMENT UI ── $ pip install datasette
$ datasette mydb.db # web UI on port 8001

── BACKUP SCRIPT ── $ mysqldump -u root --all-databases > ~/backup_$(date +%Y%m%d).sql
07
📦 DevOps — Git · Docker · SSH · CI/CD
// Real engineering workflows on Android
devops.sh
── GIT SETUP ── $ pkg install -y git gh
$ git config --global user.name "YourName"
$ git config --global user.email "you@email.com"
$ git config --global core.editor nano
$ ssh-keygen -t ed25519 -C "you@email.com"
$ cat ~/.ssh/id_ed25519.pub # copy to GitHub SSH keys

── DOCKER (via proot-distro) ── $ pkg install -y proot-distro
$ proot-distro install ubuntu
$ proot-distro login ubuntu
# Inside Ubuntu: install Docker normally
(ubuntu)$ apt install docker.io -y

── SSH SERVER (control phone from laptop) ── $ sshd # starts SSH on port 8022
$ whoami && ip addr show wlan0 # get your phone's IP
# From laptop: ssh -p 8022 username@PHONE_IP

── GITHUB ACTIONS RUNNER (CI/CD) ── $ gh auth login
$ gh repo create myproject --public
$ gh workflow run

── MONITORING ── $ pkg install -y htop neofetch termux-api
$ htop # real-time resource monitor
08
📱 APK / App Backend — Mobile API Server
// Build REST/GraphQL APIs · connect apps · JWT auth
mobile-backend.sh
── REST API WITH FASTAPI ── $ pip install fastapi uvicorn pyjwt python-multipart passlib[bcrypt]
# Create full auth API with JWT, users, routes
$ uvicorn main:app --host 0.0.0.0 --port 8000 --reload

── GRAPHQL WITH STRAWBERRY ── $ pip install strawberry-graphql[fastapi]

── WEBSOCKET SERVER ── $ pip install websockets
# Real-time chat/notifications for your app

── PUSH NOTIFICATIONS ── $ pip install firebase-admin
# Connect Firebase → send push to Android/iOS apps

── EXPOSE TO INTERNET ── $ ./ngrok http 8000 # public URL for your API
# Or use Cloudflare Tunnel (free, no limits):
$ wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm
$ chmod +x cloudflared-linux-arm
$ ./cloudflared-linux-arm tunnel --url http://localhost:8000
PRO .zshrc — Aliases & Power Config
// Paste into ~/.zshrc — reload with: source ~/.zshrc
~/.zshrc — pro config
# ═══ PASTE THIS INTO ~/.zshrc ═══

# Aliases
alias ll='ls -la --color=auto'
alias py='python3'
alias nr='npm run'
alias gs='git status'
alias gc='git commit -m'
alias gp='git push'
alias serve='python3 -m http.server 8080'
alias myip='ip addr show wlan0 | grep "inet " | awk "{print $2}"'
alias ports='netstat -tulpn'
alias startdb='mysqld_safe --datadir=$PREFIX/var/lib/mysql &'
alias startnginx='nginx'
alias killall-servers='pkill -f "python|node|nginx|mysqld"'

# Show system info on start
neofetch

# Better history
HISTSIZE=10000
SAVEHIST=10000