【linux】如何查看和解压缩rpm文件内容

时间:2023-03-10 01:57:08
【linux】如何查看和解压缩rpm文件内容

查看rpm文件中的内容

Use following syntax to list the files for already INSTALLED package:
rpm -ql package-name

Use following syntax to list the files for RPM package:
rpm -qlp package.rpm


解压缩rpm文件

以mysql-community-common-5.6.28-2.el7.x86_64.rpm为例:

  1. rpm2cpio mysql-community-common-5.6.28-2.el7.x86_64.rpm | cpio -idmv

[root@localhost mysqlRpm]# rpm2cpio mysql-community-common-5.6.28-2.el7.x86_64.rpm | cpio -idmv
./usr/share/doc/mysql-community-common-5.6.28
./usr/share/doc/mysql-community-common-5.6.28/COPYING
./usr/share/doc/mysql-community-common-5.6.28/README
./usr/share/mysql/bulgarian
./usr/share/mysql/bulgarian/errmsg.sys
./usr/share/mysql/charsets
./usr/share/mysql/charsets/Index.xml
./usr/share/mysql/charsets/README
./usr/share/mysql/charsets/armscii8.xml
./usr/share/mysql/charsets/ascii.xml
./usr/share/mysql/charsets/cp1250.xml
./usr/share/mysql/charsets/cp1251.xml
./usr/share/mysql/charsets/cp1256.xml
./usr/share/mysql/charsets/cp1257.xml
./usr/share/mysql/charsets/cp850.xml
./usr/share/mysql/charsets/cp852.xml
./usr/share/mysql/charsets/cp866.xml
./usr/share/mysql/charsets/dec8.xml
./usr/share/mysql/charsets/geostd8.xml
./usr/share/mysql/charsets/greek.xml
./usr/share/mysql/charsets/hebrew.xml
./usr/share/mysql/charsets/hp8.xml
./usr/share/mysql/charsets/keybcs2.xml
./usr/share/mysql/charsets/koi8r.xml
./usr/share/mysql/charsets/koi8u.xml
./usr/share/mysql/charsets/latin1.xml
./usr/share/mysql/charsets/latin2.xml
./usr/share/mysql/charsets/latin5.xml
./usr/share/mysql/charsets/latin7.xml
./usr/share/mysql/charsets/macce.xml
./usr/share/mysql/charsets/macroman.xml
./usr/share/mysql/charsets/swe7.xml
./usr/share/mysql/czech
./usr/share/mysql/czech/errmsg.sys
./usr/share/mysql/danish
./usr/share/mysql/danish/errmsg.sys
./usr/share/mysql/dutch
./usr/share/mysql/dutch/errmsg.sys
./usr/share/mysql/english
./usr/share/mysql/english/errmsg.sys
./usr/share/mysql/errmsg-utf8.txt
./usr/share/mysql/estonian
./usr/share/mysql/estonian/errmsg.sys
./usr/share/mysql/french
./usr/share/mysql/french/errmsg.sys
./usr/share/mysql/german
./usr/share/mysql/german/errmsg.sys
./usr/share/mysql/greek
./usr/share/mysql/greek/errmsg.sys
./usr/share/mysql/hungarian
./usr/share/mysql/hungarian/errmsg.sys
./usr/share/mysql/italian
./usr/share/mysql/italian/errmsg.sys
./usr/share/mysql/japanese
./usr/share/mysql/japanese/errmsg.sys
./usr/share/mysql/korean
./usr/share/mysql/korean/errmsg.sys
./usr/share/mysql/norwegian
./usr/share/mysql/norwegian-ny
./usr/share/mysql/norwegian-ny/errmsg.sys
./usr/share/mysql/norwegian/errmsg.sys
./usr/share/mysql/polish
./usr/share/mysql/polish/errmsg.sys
./usr/share/mysql/portuguese
./usr/share/mysql/portuguese/errmsg.sys
./usr/share/mysql/romanian
./usr/share/mysql/romanian/errmsg.sys
./usr/share/mysql/russian
./usr/share/mysql/russian/errmsg.sys
./usr/share/mysql/serbian
./usr/share/mysql/serbian/errmsg.sys
./usr/share/mysql/slovak
./usr/share/mysql/slovak/errmsg.sys
./usr/share/mysql/spanish
./usr/share/mysql/spanish/errmsg.sys
./usr/share/mysql/swedish
./usr/share/mysql/swedish/errmsg.sys
./usr/share/mysql/ukrainian
./usr/share/mysql/ukrainian/errmsg.sys
4354 blocks
[root@localhost mysqlRpm]# clr
[root@localhost mysqlRpm]# ll
total 2336
drwxr-xr-x. 3 root root    4096 Feb  3 20:51 .
dr-xr-x---. 4 root root    4096 Feb  3 20:47 ..
-rw-r--r--. 1 root root  262280 Feb  3 20:50 mysql-community-common-5.6.28-2.el7.x86_64.rpm
-rw-r--r--. 1 root root 2115880 Feb  3 20:50 mysql-community-libs-5.6.28-2.el7.x86_64.rpm
drwxr-xr-x. 3 root root      18 Feb  3 20:51 usr(解压缩之后生成的)