Hello reader, welcome to this article that is about Termux package management. You may ask yourself why to talk about Termux package management and yet you know how to use termux. But let me tell you that there are many reasons you should know about it to not do mistakes in the future.
I also know it’s better to know about Termux management to understand how termux deal with packages. You may think it’s not important to know about Termux package management. But I’m sure when you will finish reading this article you will understand why I wrote this article.
There are many articles all over the internet that discuss termux hacking. But what I saw is that most of them forget to talk about important things to help Termux users. The reason why we are going to discuss this forgotten topic is that it’s rare to get. Also, I wrote about the differences between termux and Linux because people were confusing about it, so I decided to help them as I do now.
Termux uses apt and dpkg for package management, similar to Ubuntu or Debian. So what are the differences? I invite you to read this article, the differences between termux and Linux to have a clear understanding.
Using Termux package management
As you might know, Termux uses apt and dpkg for package management. We strongly recommend using a pkg utility instead of apt directly. It is a wrapper that performs a number of tasks:
- Provides command shortcuts. Use “pkg in” instead of “pkg install” or “apt install”.
- Automatically runs “apt update” before installing a package if necessary.
- Performs some client side repository load-balancing by automatically switching mirrors on a regular basis. That is important to prevent termux hitting quota limit on hosting.
Install Termux package
Installing a package in termux is simple than you might think. It is highly recommended to upgrade existing packages before installing the new one. You can install updates by running this command:
pkg update pkg install "package-name"
Additionally, it’s better to check for updates at least once a week or when you want to install a new package. Otherwise, there is a certain risk that during package installation or upgrade you will encounter issues.
You may also like to know why you should avoid using termux for hacking
Then, when it comes to removing an installed package, make sure you know the name of that package then, use the command:
pkg uninstall "package name"
The package will be removed but modified configuration files will be left intact. If you want to remove them, use apt purge instead.
there are other additional commands which you can use with pkg.
|Remove outdated .deb files from the cache.|
|Remove all .deb files from the cache.|
|List files installed by the specified package.|
|List all available packages.|
|List currently installed packages.|
|Re-install specified package.|
|Search package by a query.|
|Show information about a specific package.|
Termux official repositories
Termux is having one official repository, and also some additional repositories. Those repositories provide content on a specific topic and can be enabled by installing packages with names ending in
The main repository of termux can be found on this link: https://packages.termux.org/apt/termux-main/. Also, all packages for termux official repositories are built from scripts located in github.com/termux/ and are maintained and signed by members of the Termux developer team. And, the public keys for verifying signatures are provided in the package
You may like also to know what are the differences between termux and Linux
Other Termux repositories
|Repository||Command to subscribe to the repository|
|x11-packages (Android 7+ only)|
|unstable- packages (Android 7+ only)|
Packages command errors
Termux moved the primary Termux package repository hosting from Bintray to Mirrors since Bintray has shut down on May 1st, 2021. This created problems for users while running package installation and update commands with
apt and commands will fail with errors similar to the following:
E: The repository 'https://termux.org/packages stable Release' does no longer have a Release file. N: Metadata integrity can't be verified, repository is disabled now. N: Possible cause: repository is under maintenance or down (wrong sources.list URL?).
If that is the case, then run
termux-change-repo command and change your mirror for the
main repository to a different Termux Mirror. If you have installed other package repositories, like science, games and unstable, then you must select and change those mirrors as well. You can check your current mirrors by running termux-info.
If for some reason termux-change-repo is not available, you can manually edit the source.list to replace the main URL with a value obtained from Termux Mirrors List. Run nano $PREFIX/etc/apt/sources.list to edit it. This will not change the URLs of other package repositories, to change those run pkg install termux-tools afterwards and use termux-change-repo or manually edit their files under $PREFIX/etc/apt/sources.list directory.