This repository contains Shell scripts for Termux, a terminal emulator for Android. These scripts include setup automation, shortcuts, installations and configurations of development tools and emulation environments such as proot, proot-distro, QEMU system emulation, and box64, and more.
Termux (com.termux) can be installed from F-Droid.
WARNING: If you installed termux from Google Play or a very old version, then you will receive package command errors. Google Play builds are deprecated and no longer supported. It is highly recommended that you update to termux-app v0.118.0 or higher as soon as possible for various bug fixes, including a critical world-readable vulnerability reported at https://termux.github.io/general/2022/02/15/termux-apps-vulnerability-disclosures.html. It is recommended that you shift to F-Droid or GitHub releases.
Refer to Android-Non-Root for more information.
- Sufficient storage (calculated on Termux 0.118.3):
- Approximately 0.2 GB for the Termux app itself.
- Approximately 7.3 GB in total for the minimal configuration with
XFCE=0,ANDROID=0, andTERMUX='' UBUNTU='' UBUNTUINSTALL=0 DEBIAN='' DEBIANINSTALL=0 UBUNTUBOX='' UBUNTUBOXINSTALL=0 DEBIANBOX='' DEBIANBOXINSTALL=0 - Approximately 0.4 GB more for
XFCE=1. - Approximately 2.6 GB more for
ANDROID=1. - Approximately 0.1 GB more for a nonempty
TERMUX. - Approximately 0.3 GB more for a nonempty
UBUNTU. - Approximately 0.2 GB more for a nonempty
DEBIAN. - Approximately 36.6 GB more for
UBUNTUINSTALL=1. - Approximately 36.6 GB more for
DEBIANINSTALL=1. - Approximately 57.4 GB in total for the default configuration with
XFCE=1,ANDROID=1, andTERMUX='termux' UBUNTU='ubuntu' UBUNTUINSTALL=1 DEBIAN='debian' DEBIANINSTALL=0 UBUNTUBOX='' UBUNTUBOXINSTALL=0 DEBIANBOX='' DEBIANBOXINSTALL=0
- Sufficient power supply.
- Stable internet connection.
- It is recommended to turn off the battery optimization for Termux.
- It is recommended to hold wakelock while running these scripts. You can do so by opening Termux, pulling down the notification bar, and then tapping Acquire wakelock on the notification of Termux.
- It is recommended to prevent the
Process completed (signal 9) - press Entererror in advance. You may encounter it when using Termux, especially when running VMs. To prevent it from occuring, please read tutorial about it in my Android Non Root: https://willie169.github.io/Android-Non-Root/#process-completed-signal-9---press-enter-error for the fixes.
- It is suggested to run
termux-change-repoand select repo(s) closer to your geographical location for faster download. termux-setup-storage pkg update && pkg install git -y cd ~ && git clone https://github.com/Willie169/termux-sh.git- Optionally edit the variables in the beginning of
~/termux-sh/termux-setup.sh(nanofor example). In VM names variables,(space) will be replaced with_, names that are not allowed will be added a suffix1:pkg install nano nano ~/termux-sh/termux-setup.sh - Run the setup script:
bash ~/termux-sh/termux-setup.sh - Follow the prompts until it exits automatically.
- Run
gh auth login --scopes repo,read:org,admin:org,workflow,gist,notifications,delete_repo,write:packages,read:packagesto login to GitHub. - Run
git config --global user.name [your_name] && git config --global user.email [your_email]to config git.
The variables below refer to the variables set in the beginning of termux-setup.sh.
- Termux properties adjustments: Enables external app access in
termux.properties. - Shortcut configuration: Copies shortcuts from
DOTshortcutsinto~/.shortcutsfolder (for Termux:Widget) andDocuments.sh,Download.sh,Scripts.sh,Storage.sh,proot-termux.sh,proot-ubuntu.sh,proot-debian.sh,proot-ubuntubox.sh,proot-debianbox.shinto home directory~. See Shortcuts section for more information. - Bashrc configuration: Copies
~/.bashrc.dand~/.bashrcfrom my bashrc repo (can be updated withupdate_bashrc). - PulseAudio startup: Starts PulseAudio automatically in
~/.bashrc. - VirGL server startup: Starts VirGL server automatically in
~/.bashrcaccording to my https://github.com/Willie169/termux-x11-virgl-gpu-acceleration repo and with variables exported in~/.bashrc. - Termux packages installation: Installs Termux packages set in
$PKG. The default ones include tools for C, C++, Python3, Java21, Node.js, Rust, Go, Ruby, Perl, GitHub CLI, GitLab CLI, OpenSSL, OpenSSH, JQ, FFMPEG, Maven, Zsh, PRoot, RARLAB UnRAR, Icarus Verilog, Ngspice, jpegoptim, optipng, libheif, LibWebP, ImageMagick, Inkscape, Poppler, qpdf, PDFtk, Ghostscript, XMLStarlet, GTKWave, Matplotlib, Ninja, SciPy, SQLite 3, Termux:X11, Octave, QEMU, and more. Note that you may need to download and install APK from https://github.com/termux/termux-x11 release to use Termux:X11. If you encounterMake sure an X server isn't already running(EE)error, close Termux and wait a few seconds, or Force stop and Clear cache Termux and Termux:X11 apps in Android system settings. - XFCE desktop environment: Installs XFCE desktop environment if not
XFCE=0. It can be started with Termux:X11 by runningtermux-x11 :0 -xstartup "dbus-launch --exit-with-session xfce4-session", where0can be replaced with other numbers, which has been defined as a functionxxfcewith an optional argument for display (e.g.,:0). - Android Build Environment Setup: Setup Android apps build environment if not
ANDROID=0using script modified from my termux-android-sdk-ndk repo. Refer to it for more information. - Vim and Neovim configuration: Installs my modified version of vimrc by Amir Salihefendic (amix) for both Vim and Neovim, and lazy.nvim and Neovim plugins from my bashrc repo (can be updated by running
update_nvim) for Neovim, if notVIMRC=0. - NPM packages: Installs NPM packages set in
$NPMlocally in~and NPM packages set in$NPMGglobally. - Pip packages: Installs pip packages set in
PIP. - Pipx packages: Installs pip packages set in
PIPX. - Go packages: Installs Go packages set in
GO. - JARs: Installs ANTLR 4 (JAR in
/usr/local/java) if notANTLR=0and PlantUML (JAR in/usr/local/java) if notPLANTUML=0. - Proot-distro Termux environment: Installs an Termux proot-distro environment with alias
$TERMUXand add boot scriptproot-$TERMUX.shinto home directory~and~/.shortcutsfolder (for Termux:Widget) if$TERMUXis not empty string. - Proot-distro Ubuntu environment: Installs an Ubuntu ARM64 proot-distro environment with alias
$UBUNTUif$UBUNTUis not empty string, and runsubuntu-debian.shin it if$UBUNTUis not empty string and$UBUNTUINSTALLis not0. See Invoked VM Setup Scripts section for more information. - Proot-distro Debian environment: Installs Debian ARM64 proot-distro environment with alias
$DEBIANif$DEBIANis not empty string, and runsubuntu-debian.shin it if$DEBIANis not empty string and$DEBIANINSTALLis not0. See Invoked VM Setup Scripts section for more information. - Proot-distro Ubuntu environment with Box64, Wine64, and Winetricks (not invoked by default and no longer actively maintained): Installs Ubuntu ARM64 proot-distro environment with alias
$UBUNTUBOXif$UBUNTUBOXis not empty string, and runsbox64-wine64-winetricks.sh(no longer actively maintained) in it if$UBUNTUBOXis not empty string and$UBUNTUBOXINSTALLis not0. See Invoked VM Setup Scripts section for more information. - Proot-distro Debian environment with Box64, Wine64, and Winetricks (not invoked by default and no longer actively maintained): Installs Debian ARM64 proot-distro environment with alias
$DEBIANBOXif$DEBIANBOXis not empty string, and runsbox64-wine64-winetricks.sh(no longer actively maintained) in it if$DEBIANBOXis not empty string and$DEBIANBOXINSTALLis not0. See Invoked VM Setup Scripts section for more information.
These scripts will be invoked by Termux Setup if corresponding configuration is set.
ubuntu-debian.sh: Configures PulseAudio and VirGL (according to my https://github.com/Willie169/termux-x11-virgl-gpu-acceleration repo and with variables exported in~/.bashrc) and installs development tools, runtime environments, and utilities for C, C++, Python3, Java 21, Node.js LTS (via NVM), Yarn, Rust, Go, Ruby, Perl, Fortran, Qt5, .NET SDK 10, ASP.NET Core Runtime 10, Aptitude, GitHub CLI, OpenSSL, OpenSSH, JQ, DMG2IMG, libguestfs, GHC Filesystem, FFMPEG, Pandoc, TeX Live (via regular installation instead of APT, for unrestrictedtlmgrand updates), Maven, Zsh, iproute2, net-tools, Nmap, Alien, nvm, pnpm, Yarn, NPM packagesjsdom markdown-toc marked marked-gfm-heading-id node-html-markdown showdownlocally in~, http-server, Bun, Homebrew, Glow, Tennis, Miniforge, pipx, uv, Poetry, MarkItDown, gh2md, LibreTranslate, Jupyter Notebook, JupyterLab, Jupytext, Meson, Tree-sitter CLI, pylatexenc, lazy.nvim and Neovim plugins from my bashrc repo (can be updated by runningupdate_nvim), LSP servers, Microsoft True Type Core Fonts, Noto CJK fonts, CNS11643中文標準交換碼全字庫正楷體與正宋體, RARLAB UnRAR, Icarus Verilog, Verilator, Ngspice, Caneda, jpegoptim, optipng, libheif, LibWebP, ImageMagick, Inkscape, Poppler, qpdf, PDFtk, Ghostscript, Bookletimposer, Audacity, abcde, XMLStarlet, GTKWave, SDL2, SDL2 BGI, llmfit, ANTLR 4 (JAR in/usr/local/java), Firefox, Octave, XFCE desktop environment (can be started with Termux:X11 by runningtermux-x11 :0 &, logging into Proot-distro with--shared-tmpoption, and runningexport DISPLAY=:0andxfceinside, where0can be replaced with other numbers), fix for stuckelementary-xfce-icon-themefrom my fix-elementary-xfce-icon-theme repo, PlantUML (JAR in/usr/local/java), SQLite 3, PostgreSQL 17, KataGo (~/KataGo/cpp/katagoand can be run withkatago) and KataGo networkkata1-b6c96-s175395328-d26788732(in~/katago-networks, other networks can be downloaded from https://katagotraining.org/networks), LizzieYzy (can be launched by runninglizzieyzyor with desktop entry~/.local/share/applications/lizzieyzy.desktopor~/desktop/lizzieyzy.desktop, runtime directory~/.lizzieyzy, KataGo networkkata1-b6c96-s175395328-d26788732configured as default engine and estimate engine in~/.lizzieyzy/config.txt, which can be updated by runningupdate_lizzieyzy_config), Fairy-Stockfish (~/Fairy-Stockfish/src/stockfishand can be run withstockfish), Cute Chess (GUI at~/cutechess/build/cutechessand can be launched by runningcutechessor with desktop entry~/.local/share/applications/cutechess.desktopor~/desktop/cutechess.desktop, CLI at~/cutechess/build/cutechess-cliand can be run withcutechess-cli, Fairy-Stockfish configured as engine in~/.config/cutechess/engines.json, which can be updated by runningupdate_cutechess_config), Sylvan (GUI at~/Sylvan/projects/gui/sylvanand can be launched by runningsylvanor with desktop entry~/.local/share/applications/sylvan.desktopor~/desktop/sylvan.desktop, CLI at~/Sylvan/projects/cli/sylvan-cliand can be run withsylvan-cli, Fairy-Stockfish configured as engine in~/.config/EterCyber/engines.json, which can be updated by runningupdate_sylvan_config), my modified version of vimrc by Amir Salihefendic (amix) for both Vim and Neovim (can be updated by runningupdate_vimrc), my LaTeX packagephysics-patchand checks outdevbranch and my LaTeX templateLaTeX-ToolKit(can be updated withupdate_latex), and more, and copies~/.bashrc.dand~/.bashrcfrom my bashrc repo (can be updated by runningupdate_bashrc), on Ubuntu or Debian ARM64 Proot environment.box64-wine64-winetricks.sh: Installsbox64,wine64, andwinetricksfor running x86_64 Linux and Windows applications on Debian derivatives ARM64. (No longer actively maintained.)
Shortcuts are located in DOTshortcuts. Some of them are intended for tools that is not installed or configured in the Termux Setup, such as QEMU. Some related scripts are in Additional Scripts.
proot-termux.sh: Boot Termux Proot-distro environments installed intermux-setup.shwith--isolated --fix-low-ports --no-arch-warning. See Termux Setup section for more information.proot-ubuntu.sh,proot-debian.sh,proot-ubuntubox.sh,proot-debianbox.sh: Boot those Proot-distro environments installed intermux-setup.shrespectively with--isolated --fix-low-ports --shared-tmp --no-arch-warning --bind /apex --bind /data/dalvik-cache --bind /system --bind /linkerconfig --bind /vendor --bind /data/data/com.termux/files/usr/bin --bind /data/data/com.termux/files/usr/lib --bind /data/data/com.termux/files/usr/libexec, and environmental variablesTHISpointing to the rootfs of the current Proot-distro,TERMUX_HOMEpointing to$HOMEof Termux, andTERMUX_PREFIXpointing to$PREFIXof Termux. See Termux Setup section for more information.qemu-alpine-aarch64.sh,qemu-alpine-aarch64-vnc.sh,qemu-alpine-x86_64.sh,qemu-alpine-x86_64-vnc.sh,qemu-debian-aarch64.sh,qemu-debian-aarch64-vnc.sh,qemu-alpine-amd64.sh,qemu-debian-amd64-vnc.sh,qemu-bliss-vnc.sh: Boot respective QEMU system emulation VMs with-netdev user,id=n1,dns=8.8.8.8,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1option, where files with-vncin their names start VNC server at the host'slocalhost:0and others are-nographic. Those VMs can be installed withqemu-alpine-aarch64-install.sh,qemu-alpine-x86_64-install.sh,qemu-debian-arm64-install.sh,qemu-debian-amd64-install.sh, andqemu-bliss-install.shrespectively. See Additional Scripts for details. (No longer actively maintained.)nethunter.sh: Boots the Kali Nethunter Proot-distro instance with the aliaskali-defaultas userkaliwithisolatedandfix-low-portsoptions.
Storage.sh:cd /storage/emulated/0.Documents.sh,Download.sh,Scripts.sh:cdthose directories in/storage/emulated/0respectively.xmrig-xmr.sh: Mines XMR to the repository owner's wallet,48j6iQDeCSDeH46gw4dPJnMsa6TQzPa6WJaYbBS9JJucKqg9Mkt5EDe9nSkES3b8u7V6XJfL8neAPAtbEpmV2f4XC7bdbkv, using my modified version of XMRig and through Tor, which is not installed in the Termux Setup and can be installed withxmrig-install.sh. Change the wallet address and other configurations if you want.termux-backup-bz.sh: Creates a compressed bzip2 backup with the highest compression level of/data/data/com.termux/files/homeand/data/data/com.termux/files/usrsplit into 4000MB parts.
These scripts are not invoked by Termux Setup. Run it separately if you need it.
qemu-alpine-aarch64-install.sh,qemu-alpine-x86_64-install.sh,qemu-debian-arm64-install.sh,qemu-debian-amd64-install.sh,qemu-bliss-install.sh: Setup and boot the respective QEMU system emulation VMs with-netdev user,id=n1,dns=8.8.8.8,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1option, where the Alpine VMs are created from Virt 3.21.0 ISO images and the Debian VMs are pre-created Bookworm QCOW2 images.qemu-bliss-install.shstarts VNC server at the host'slocalhost:0and others are-nographic. Remember tosetup-alpinein Alpine VMs and resize disk in Debian VMs. Bliss OS is an Android-based open source OS for x86_64 architecture that incorporates many optimizations, features, and that supports many more devices. (No longer actively maintained.)xmrig-install.sh: Builds my modified version of XMRig, an open source, cross-platform RandomX, KawPow, CryptoNight and GhostRider CPU/GPU miner, RandomX benchmark, and stratum proxy, on Termux.proot-install-nethunter.sh: Installs Kali Nethunter ARM64 proot-distro environment from https://github.com/sagar040/proot-distro-nethunter. Follow the screen guide and enter wanted Build ID to install, e.g.,KBDEXKMTEfor everything andKBDEXKMTDfor default. Boot it with<build id> [USER]orproot-distro login <build id> [USER]. Open GUI after logged in withsudo kgui. Please go to https://github.com/sagar040/proot-distro-nethunter for more information.debian-buster-xfce-mod.sh: Modified version ofAndronix's debian-xfce.sh, which installs and configures XFCE desktop environment and VNC server for Debian Buster ARM64 PRoot environment.proot-install-buster-cli.sh: Installs Andronix Debian Buster ARM64 PRoot CLI-only environment in~/$BUSTERCLIif$BUSTERCLIis not empty string usingAndronix's debian.sh. Configure theBUSTERCLIvariable in the file to change the directory.proot-install-buster-xfce.sh: Installs Andronix Debian Buster ARM64 PRoot environment with XFCE desktop environment and VNC server in~/$BUSTERXFCEif$BUSTERXFCEis not empty string usingdebian-buster-xfce-mod.sh.
This repository is licensed under GNU General Public License General Public License, see LICENSE.md for details.