Termux package management everything you need to know

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

termux package

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.

pkg autocleanRemove outdated .deb files from the cache.
pkg cleanRemove all .deb files from the cache.
pkg files List files installed by the specified package.
pkg list-allList all available packages.
pkg list-installedList currently installed packages.
pkg reinstall Re-install specified package.
pkg search Search package by a query.
pkg show 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-repo.

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 ingithub.com/termux/and are maintained and signed by members of theTermux developer team. And, the public keys for verifying signatures are provided in the packagetermux-keyring.

You may like also to know what are the differences between termux and Linux

Other Termux repositories

RepositoryCommand to subscribe to the repository
game-packagespkg install game-repo
science-packagespkg install science-repo
termux-root-packagespkg install root-repo
x11-packages(Android 7+ only)pkg install x11-repo
unstable- packages(Android 7+ only)pkg install unstable-repo

Packages command errors

Termux moved the primary Termux package repository hosting fromBintray to MirrorssinceBintray has shut down on May 1st, 2021. This created problems for users while running package installation and update commands withpkgoraptand 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 runtermux-change-repocommand andchange your mirrorfor themainrepository to a differentTermux Mirror. If you have installed other package repositories, likescience,gamesandunstable, then youmustselect and change those mirrors as well. You can check your current mirrors by running termux-info.

If for some reason termux-change-repois not available, you can manually edit the source.listto replace the mainURL with a value obtained fromTermux Mirrors List. Run nano $PREFIX/etc/apt/sources.listto edit it. This will not change the URLs of other package repositories, to change those run pkg install termux-toolsafterwards and use termux-change-repoor manually edit their files under $PREFIX/etc/apt/sources.listdirectory.

You may also like...

2 Responses

  1. 17 August 2023

    […] Termux package management […]

  2. 4 October 2023

    […] your hacking skills with this powerful tool! The first thing to do is to update and upgrade the termux repositories using the […]

Leave a Reply