Android is Linux, right?!
This is a guide on how to turn your Android device into an environment you can develop in.
Basic Setup
-
Install Termux from F-Droid. (That also means install F-Droid if you don't have it.)
-
Run
pkg update && pkg upgrade
, thenpkg install git curl
-
Make yourself feel at home. Sometimes you'll need to do stuff in Termux, so you can install your favorite shell to make that experience more cosy. For me, that means:
- Install Fish shell (
apt install fish
) and make it the default login shell (chsh -s $(which fish)
), then launch it (fish
) - Install Oh My Fish:
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
- Install the robbyrussell theme:
omf install robbyrussell
- Configure Git:
-
git config --global user.name "Joe Mama"
(replace the name with your own name) -
git config --global user.email "joe@example.com"
(replace the email with your own) - Set main as the default git branch:
git config --global init.defaultBranch main
- Generate an SSH key (
ssh-keygen -t ed25519 -C "joe@example.com"
) and upload the public key to GitHub/GitLab
-
- Install Fish shell (
-
Now, we'll install a Ubuntu container using PRoot .
-
pkg install proot-distro
-
proot-distro install ubuntu
-
proot-distro login ubuntu
-
apt update && apt upgrade
-
apt install sudo adduser git curl wget
- Create a new user:
useradd joe --ingroup sudo --disabled-password
(replacejoe
with your desired username) - Set password to empty
passwd -d joe
(wherejoe
is your username) - Allow the user to use
sudo
without password:-
nano /etc/sudoers
- add line:
joe ALL=(ALL) NOPASSWD:ALL
(wherejoe
is your username) - save (Ctrl+O, Enter) and exit (Ctrl+X)
-
-
exit
-
-
From now on, you can log in to the Ubuntu container using
proc-distro login ubuntu -- su -l joe
(wherejoe
is your username). I advise you to create an alias for it – for example in my setup, I addedalias ubuntu = proc-distro login ubuntu -- su -l joe
to~/.config/fish/config.fish
. -
Launch the Ubuntu container and make yourself feel at home there, too (eg. repeat Step 3).
Accessing Termux’s Storage From the Container and Vice Versa
From the container, you can find Termux's files under /data/data/com.termux/files/
. From Termux, you can access the container's file system via /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/
.
Install Toolchains for Programming Languages
- Rust Toolchain
- Launch the Ubuntu container
-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- if you're not using bash, add
export PATH="$HOME/.cargo/bin:$PATH"
to your shell config