rpm是centos的包管理工具同是也是一种包的格式。
如果你想让你的东西很好的被别人在centos系统上安装,管理,和使用,则你可以将它打包成一个rpm.
虽然我们也可以直接提供tar包,但是rpm提供了更多了信息:
1. metadata. 其包含了包的组建,包的version,包的大小,包的所属组,项目的URL等其他相关的信息
2. 发布这个包到一个repo里面,其然人使用的时候,安装这个repo就可以进行使用了,且方便更新和维护
下面让我们试验7步编译源代码为RPM包
步骤1: 安装rpm-build
编包的直接的命令为‘rpmbuild’,而rpm-build提供了rpmbuild

如果rpm-build则会如图所示,显示已经安装
步骤二: 创建编码所需的目录结构

步骤三:下载源代码

步骤四: 编写SPEC文件

步骤5: rpmbuild编包

步骤6:查看编译出的RPM包

步骤7:安装RPM进行验证

注:本实验是参照如下博客完成:
https://www.thegeekstuff.com/2015/02/rpm-build-package-example
所有步骤源码可参考:https://github.com/testcara/install_scripts/blob/master/build_rpm.sh
网友评论