¿Cómo listar el contenido de un paquete usando YUM?


Sé cómo usar rpm para listar el contenido de un paquete (rpm -qpil package.rpm). Sin embargo, esto requiere conocer la ubicación de la .archivo rpm en el sistema de archivos. Una solución más elegante sería utilizar el gestor de paquetes, que en mi caso es YUM. ¿Cómo se puede utilizar YUM para lograr esto?

Author: Lorin Hochstein, 2008-09-19

7 answers

Hay un paquete llamado yum-utils que se basa en YUM y contiene una herramienta llamada repoquery que puede hacer esto.

$ repoquery --help | grep -E "list\ files" 
  -l, --list            list files in this package/group

Combinado en un ejemplo:

$ repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz

En al menos un sistema RH, con rpm v4. 8. 0, yum v3.2.29 y repoquery v0.0.11, repoquery -l rpm no imprime nada.

Si tiene este problema, intente agregar la bandera --installed: repoquery --installed -l rpm.


DNF Actualización:

Para usar dnf en lugar de yum-utils, use el siguiente comando:

$ dnf repoquery -l time
/usr/bin/time
/usr/share/doc/time-1.7
/usr/share/doc/time-1.7/COPYING
/usr/share/doc/time-1.7/NEWS
/usr/share/doc/time-1.7/README
/usr/share/info/time.info.gz
 398
Author: Thomas Vander Stichele,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-11 22:20:19
rpm -ql [packageName]

Ejemplo

# rpm -ql php-fpm

/etc/php-fpm.conf
/etc/php-fpm.d
/etc/php-fpm.d/www.conf
/etc/sysconfig/php-fpm
...
/run/php-fpm
/usr/lib/systemd/system/php-fpm.service
/usr/sbin/php-fpm
/usr/share/doc/php-fpm-5.6.0
/usr/share/man/man8/php-fpm.8.gz
...
/var/lib/php/sessions
/var/log/php-fpm

No es necesario instalar yum-utils, ni conocer la ubicación del archivo rpm.

 131
Author: Levit,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-27 07:24:42
$ yum install -y yum-utils

$ repoquery -l packagename
 73
Author: Hüseyin Ozan TOK,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-19 03:13:37

No creo que puedas listar el contenido de un paquete usando yum, pero si tienes el .archivo rpm en su sistema local (como muy probablemente será el caso de todos los paquetes instalados), puede usar el comando rpm para listar el contenido de ese paquete de la siguiente manera:

rpm -qlp /path/to/fileToList.rpm

Si no tiene el archivo de paquete (.rpm), pero tiene el paquete instalado, pruebe esto:

rpm -ql packageName
 28
Author: Thomi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-05 10:43:13

Hay varias respuestas buenas aquí, así que permítanme proporcionar una terrible:

: you can type in anything below, doesnt have to match anything

yum whatprovides "me with a life"

: result of the above (some liberties taken with spacing):

Loaded plugins: fastestmirror
base | 3.6 kB 00:00 
extras | 3.4 kB 00:00 
updates | 3.4 kB 00:00 
(1/4): extras/7/x86_64/primary_db | 166 kB 00:00 
(2/4): base/7/x86_64/group_gz | 155 kB 00:00 
(3/4): updates/7/x86_64/primary_db | 9.1 MB 00:04 
(4/4): base/7/x86_64/primary_db | 5.3 MB 00:05 
Determining fastest mirrors
 * base: mirrors.xmission.com
 * extras: mirrors.xmission.com
 * updates: mirrors.xmission.com
base/7/x86_64/filelists_db | 6.2 MB 00:02 
extras/7/x86_64/filelists_db | 468 kB 00:00 
updates/7/x86_64/filelists_db | 5.3 MB 00:01 
No matches found

: the key result above is that "primary_db" files were downloaded

: filelists are downloaded EVEN IF you have keepcache=0 in your yum.conf

: note you can limit this to "primary_db.sqlite" if you really want

find /var/cache/yum -name '*.sqlite'

: if you download/install a new repo, run the exact same command again
: to get the databases for the new repo

: if you know sqlite you can stop reading here

: if not heres a sample command to dump the contents

echo 'SELECT packages.name, GROUP_CONCAT(files.name, ", ") AS files FROM files JOIN packages ON (files.pkgKey = packages.pkgKey) GROUP BY packages.name LIMIT 10;' | sqlite3 -line /var/cache/yum/x86_64/7/base/gen/primary_db.sqlite 

: remove "LIMIT 10" above for the whole list

: format chosen for proof-of-concept purposes, probably can be improved a lot
 3
Author: barrycarter,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-01 19:17:34

Yum no tiene su propio tipo de paquete. Yum opera y ayuda a administrar RPMs. Por lo tanto, puede usar yum para listar los RPMs disponibles y luego ejecutar el comando rpm-qlp para ver el contenido de ese paquete.

 0
Author: Haabda,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2008-09-19 17:55:28

Actualmente reopquery está integrado en dnf y yum, por lo que escribe:

dnf repoquery -l <pkg-name>

Listará el contenido de los paquetes de un repositorio remoto (incluso para los paquetes que aún no están instalados)

Lo que significa instalar un paquete dnf-utils o yum-utils separado ya no es necesario para la funcionalidad, ya que ahora se admite de forma nativa.


For listing installed or local (*.rpm contenido de los paquetes hay rpm -ql

No creo que lo sea posible con yum org dnf (no repoquery subcomando)

Por favor corrígeme si estoy equivocado

 0
Author: w17t,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-13 12:36:53