Android Termux Proot Container

Android Termux Proot Container

Shetty Yttehs Lv2

Before Reading

In this passage I will install Linux container on Android via Termux app.

And I will build a development environment:

  • Desktop
  • VNC login
  • VSCode

Environment

Please note that the difference of devices and version of Termux may have unknown behaviours.

This is my environment:

DeviceArchitectureAndroid VersionTermuxVNC App
OnePlus Ace 3Vaarch64/arm6415googleplay.2025.01.18RVNC Viewer 4.9.2.60169
Waydroid x86-64x86_64110.119.0-beta.1RVNC Viewer 4.9.2.60169

Info

In this guide, ArchLinux is the example.

Errata

Before delving into the text, it’s important to note that there may be some grammar or syntax errors present. This could be due to translation errors, typing mistakes, or the author’s unique writing style ( I’m a Chinese native speaker 😅 ).

Install Proot Container

Open Termux app.

  1. Update packages.
1
apt update && apt upgrade
  1. Install packages.
1
apt install proot proot-distro
  1. Download and install ArchLinux.
1
proot-distro install archlinux
  1. Login to Linux distribution.
1
proot-distro login archlinux
  1. (Optional) Use fish shell for better experience.
1
2
3
pacman -Syu
pacman -S fish
chsh -s /bin/fish

Install VNC and Desktop on ArchLinux

Make sure you have logged in ArchLinux.

  1. Update system packages.
1
pacman -Syu
  1. Install desktop and VNC.
1
pacman -S tigervnc xfce4

Create New User

Make sure you have logged in ArchLinux.

Replace <username> with your username such as admin.

  1. Create a user.
1
2
useradd --create-home <username>
usermod -aG adm,storage,wheel <username>
  1. Set sudo permission.
1
2
# install vi and sudo if not exists
pacman -S vi sudo
1
2
3
visudo
# or use nano
EDITOR=nano visudo

At User privilege specification:

1
2
3
4
##
## User privilege specification
##
root ALL=(ALL:ALL) ALL

Add this line:

1
<username> ALL=(ALL:ALL) ALL
  1. Set password for new user.
1
passwd <username>
  1. Login as new user.
1
2
exit
proot-distro login archlinux --user <username>

Install AUR Helper and VSCode

Make sure you have logged in ArchLinux.

  1. Add archlinuxcn source

Edit /etc/pacman.conf:

1
2
3
sudo vi /etc/pacman.conf
# or use nano
sudo nano /etc/pacman.conf

On the very bottom, add:

1
2
3
[archlinuxcn]
SigLevel = Optional TrustAll
Server = https://repo.archlinuxcn.org/$arch

Sync packages and add keyring:

1
sudo pacman -Syu archlinuxcn-keyring

Edit /etc/pacman.conf, remove this line:

1
SigLevel = Optional TrustAll
  1. Install yay package.
1
sudo pacman -S yay
  1. Install VSCode via yay.
1
2
# install base-devel if not exists
sudo pacman -S base-devel
1
yay -S visual-studio-code-bin

Warn

Do NOT run yay with sudo to avoid safety problem.

Setup and Use VNC Server

  1. Set VNC password.
1
vncpasswd
  1. Start VNC server.
1
vncserver :0
  1. Open VNC client app, login with url localhost:5900 and password.

Use VSCode

On my device, VSCode can only run WITHOUT sandbox.

1
2
cd /path/to/project
code --no-sandbox .

Enjoy

final

  • Title: Android Termux Proot Container
  • Author: Shetty Yttehs
  • Created at : 2025-01-27 14:44:38
  • Updated at : 2025-03-25 19:52:00
  • Link: https://blog.shettydev.com/2025/01/27/android-termux-proot-container/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments