Unfortunately you can't.
The packages you install using pkg install
, which is actually a wrapper for the frontend of the famous Debian Package Manager, APT. APT downloads packages provided by Termux and installs them. So the packages are just Debian packages. Witha bit of Googling and/or digging, you'll find that file paths are hardcoded, i.e., they'll always be extracted (installed) into /data/data/com.termux/files/usr
.
Possible tricks are, apparently, possible. However it's not recommended to try any as Termux is highly similar to a real Linux environment, which means any bad SELinux context or wrong permission can cause programs to malfunction.
Answer: Try to free up your internal storage if you plan to install more packages in Termux, instead of thinking about installing the packages to elsewhere.