不安装rpm包,取出rpm包里的文件

时间:2021-09-17 20:34:17

1、查看rpm包里的文件

[root@VM_166_132 ~]# rpm -qlp mysql5.6.29-1-3.x86_64.rpm |more
/etc/ld.so.conf.d/mysql-5.6.23_compiled_x86_64.conf
/usr/local/lib/libjemalloc.a
/usr/local/lib/libjemalloc.so
/usr/local/lib/libjemalloc.so.1
/usr/local/lib/libjemalloc_pic.a

2、查看已安装的rpm包文件

rpm -ql mysql5.6.29-1-2.x86_64

[root@VM_166_132 ~]# rpm -qa |grep mysql
mysql5.6.29-1-3.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
[root@VM_166_132 ~]# rpm -ql mysql5.6.29-1-3.x86_64|more
/etc/ld.so.conf.d/mysql-5.6.23_compiled_x86_64.conf
/usr/local/lib/libjemalloc.a
/usr/local/lib/libjemalloc.so
/usr/local/lib/libjemalloc.so.1
/usr/local/lib/libjemalloc_pic.a

3、将rpm转换为cpio文件

[root@VM_166_132 ~]# rpm2cpio mysql5.6.29-1-3.x86_64.rpm >5.6.29.cpio

4、cpio是用来建立、还原备份档的工具程序,它可以加入、解开cpio或tar备份档内的文件。

[root@VM_166_132 test]# mkdir test;cd test;

[root@VM_166_132 test]# cpio -ivd <../5.6.29.cpio

./etc/ld.so.conf.d/mysql-5.6.23_compiled_x86_64.conf
./usr/local/lib/libjemalloc.a
./usr/local/lib/libjemalloc.so
./usr/local/lib/libjemalloc.so.1
./usr/local/lib/libjemalloc_pic.a

5、现在就可以在当前目录下,拷贝指定的文件了。^_^