0

In sources.list package repositories are specified in the format

deb url distribution component(s)

How can I explicitly say with apt-get from what component to install a package?

2 Answers 2

1

You can't do that. The packages are not repeated in different components.

So, if you want to install a software and your apt configuration (repos in the source.list file) is not finding it, you should try to check in which component the software is and add it, then update and try to install again.

Good luck.

Source: https://wiki.debian.org/SourcesList

0

You can install software from specific components, but more easily and accurately, different version/releases of software.

The easiest way to start is to search for packages. For example, you may decide to add the official NGINX repositories to /etc/apt/sources.list.d/nginx.list. This could also be a personal, or private repository, with versions patched with security or custom updates.

Use apt to search related packages:

$ apt search nginx
...


nginx/stable 1.14.2-1~bionic all [upgradable from: 1.10.3-1+deb9u2]
  small, powerful, scalable web/proxy server

nginx-common/stable,stable,now 1.10.3-1+deb9u2 all [installed,automatic]
  small, powerful, scalable web/proxy server - common files

...

The example could show nginx/stable and nginx/testing, if nginx/testing has a newer version, or if you have a custom repo.

Additional details for each package can be seen with apt show.

$ apt show nginx -a
Package: nginx
Version: 1.14.2-1~bionic
Priority: optional
Section: httpd
Maintainer: Sergey Budnevitch <[email protected]>
Installed-Size: 2,953 kB
Provides: httpd
Depends: init-system-helpers (>= 1.18~), libc6 (>= 2.17), libpcre3, libssl1.1 (>= 1.1.0), zlib1g (>= 1:1.1.4), lsb-base (>= 3.0-6), adduser
Conflicts: nginx-common
Homepage: http://nginx.org
Download-Size: 828 kB
APT-Sources: http://nginx.org/packages/debian bionic/nginx amd64 Packages
Description: high performance web server
 nginx [engine x] is an HTTP and reverse proxy server, as well as
 a mail proxy server.

...

Package: nginx
Version: 1.10.3-1+deb9u2
Priority: optional
Section: httpd
Maintainer: Debian Nginx Maintainers <[email protected]>
Installed-Size: 93.2 kB
Depends: nginx-full (<< 1.10.3-1+deb9u2.1~) | nginx-light (<< 1.10.3-1+deb9u2.1~) | nginx-extras (<< 1.10.3-1+deb9u2.1~), nginx-full (>= 1.10.3-1+deb9u2) | nginx-light (>= 1.10.3-1+deb9u2) | nginx-extras (>= 1.10.3-1+deb9u2)
Homepage: http://nginx.net
Tag: implemented-in::c, interface::daemon, network::server, network::service,
 protocol::http, role::program, use::proxying
Download-Size: 81.8 kB
APT-Manual-Installed: yes
APT-Sources: http://mirrors.linode.com/debian bionic/main amd64 Packages
Description: small, powerful, scalable web/proxy server
 Nginx ("engine X") is a high-performance web and reverse proxy server
 created by Igor Sysoev. It can be used both as a standalone web server
 and as a proxy to reduce the load on back-end HTTP or mail servers.
 .
 This is a dependency package to install either nginx-full (by default),
 nginx-light or nginx-extras.

If you have a unique component, simply pass it to apt:

$ sudo apt install nginx/stable

Otherwise, you can select a specific version (-t=target_release) and release that was unique to the component:

$ sudo apt install nginx -t='1.15.10-1~bionic'

You can see how the Debian maintainers releases look like 1.10.3-1+deb9u2, while NGINX releases look like 1.15.10-1~stretch. You could use these differences to detect this for automation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .