In our previously published article on Android Terminal Apps, we clearly indicated that Termux is practical app to us and we are going to write guides on Termux in future. Here is CLI Guide For Initial Repo Setup For Termux Android Linux Environment to Make it Like Regular GNU/Linux Server to Run Apache HTTP Server, PHP, MySQL, Python etc. Termux does what Homebrew does to a Mac – kind of missing package manager. How funny, they sell us some sort of unix system without a bash. Community hugely working with Termux repositories and sooner, like Mac we can avoid tapping on Google Play Store like monkeys for installing Free Software packages. I believe that many developer users want to install Apache2, Python on Android and play while on the road, queue etc.
Initial Repo Setup For Termux Android Linux Environment
Open Termux. We can use apt
or pkg
command. First update, upgrade :
1 2 3 4 | pkg update # apt update pkg upgrade apt update |
You’ll notice that the setup lacks sources.list
file. Also many GNU Tools are not installed by default. Let us install them :
---
1 2 3 4 5 | pkg upgrade pkg install wget curl dirmngr gnupg-curl pkg install autoconf automake bison bzip2 clang cmake pkg install coreutils diffutils flex gawk git grep gzip libtool make patch perl pkg install sed silversearcher-ag tar |
Now, to setup sources.d
directory and sources.list
file, we need to perform the below steps :
1 2 3 4 5 6 | # Download key from keyserver: apt-key adv --keyserver pgp.mit.edu --recv A46BE53C mkdir -p $PREFIX/etc/apt/sources.list.d # Setup repo echo "deb [trusted=yes] https://grimler.se root stable" > $PREFIX/etc/apt/sources.list.d/termux-root.list apt update |
It is not abnormal to receive error after running :
1 | apt-key adv --keyserver pgp.mit.edu --recv A46BE53C |
Those may appear out of firewall or some missing packages or bug. You may try this :
1 | apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 379CE192D401AB61 |
The above is for advanced setup. Normally you can run commands to search packages :
1 2 3 | pkg search apache2 pkg search nginx pkg search python |
Here are repositories and more information :
1 2 3 | https://github.com/termux/termux-packages/tree/master/packages https://github.com/termux/termux-apt-repo https://wiki.termux.com/wiki/Package_Management |