Showing posts with label Termux commands. Show all posts
Showing posts with label Termux commands. Show all posts

Friday, November 27, 2020

Package Management

 Termux uses apt and dpkg for package management, similar to Ubuntu or Debian.

Working with packages

Installing packages from APT repository

In Termux it is recommended to use package manager pkg which is a wrapper for apt. It simplifies installing or upgrading packages by automatically updating apt lists so you don't have to type apt update when installing or upgrading packages.


Install package:

pkg install [package name]


Remove package:

pkg uninstall [package name]


List all packages:

pkg list-all


Upgrading packages:

pkg upgrade

Important: before installing anything, ensure that all packages are up-to-date. Additionally, we suggesting to check for updates at least once a week. We use rolling-release updates style and do not care about compatibility of more than between current and previous versions. If you have not upgraded your Termux installation for long time and now experience errors when running package manager, the easiest way to fix will be complete reinstallation.


For more information about available commands you can either just run pkg without arguments or like this: pkg help.

Manual installation of *.deb files

If you have a *.deb package file, you can install it with dpkg. Note that packages downloaded from Ubuntu or from repositories of other Linux distributions will not work due to incompatible libc ABI, however statically compiled binaries may work.


Installing:

dpkg -i ./package.deb


Uninstalling:

dpkg --remove [package name]


Listing all installed packages:

dpkg -l


Since dpkg has many useful options, you may want to see it's manual via man dpkg.

Official repositories

Some repositories can be enabled by installing packages ending with -repo. The repositories that can be accessed in this way at the time of writing are

RepositoryCommand to subscribe to 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

For a repository to be considered official it needs to have build scripts for cross-compilation available for all hosted packages. Packages built on device and thereafter packaged with termux-create-package can therefore not be included in the official repositories.

All the repositories with build scripts in a repo at github.com/termux/ are maintained and signed by someone on the termux team, the keys used for signing are available in the package termux-keyring. For more information about how the repositories are signed, see termux-keyring.