制做rpm包工具fpm安装

时间:2022-11-20 16:52:36
安装ruby模块
[root@c01 ~]# yum install ruby rubygems ruby-devel -y
# 查看当前使用的rubygems仓库
[root@c01 ~]# gem sources list
*** CURRENT SOURCES *** http://rubygems.org/
添加国内的 淘宝的Rubygems仓库
[root@c01 ~]# gem sources --add http://gems.ruby-china.org
http://gems.ruby-china.org added to sources
[root@c01 ~]# gem sources list
*** CURRENT SOURCES *** http://rubygems.org/
http://gems.ruby-china.org 移除原生的RUBY仓库
[root@c01 ~]# gem sources -r http://rubygems.org/
http://rubygems.org/ removed from sources
[root@c01 ~]# gem sources list
*** CURRENT SOURCES *** http://gems.ruby-china.org
FPM参数说明:
常用参数
-s 指定源类型 (例如dir 目录)
-t 指定目标类型,即想要制作为什么包 (比如想做个rpm包)
-n 指定包的名字 ,-name
-v 指定包的版本号 (用于区分rpm,有同名字但版本不同)
-C 指定打包的相对路径 Change directory to here before searching forfiles
-d 指定依赖于哪些包
-f 第二次打包时目录下如果有同名安装包存在,则强制覆盖它
-p 输出的安装包的目录,不想放在当前目录下就需要指定
--post-install 执行rpm包之后所要运行的脚本;同--after-install
--pre-install 软件包安装完成之前所要运行的脚本;同--before-install
--post-uninstall 软件包卸载完成之后所要运行的脚本;同--after-remove
--pre-uninstall 软件包卸载完成之前所要运行的脚本;同--before-remove 安装fpm及json依赖包, 之前确定经已装了gcc
[root@c01 ~]# gem install json -v 1.8.3
Building native extensions. This could take a while...
Successfully installed json-1.8.3
1 gem installed
Installing ri documentation for json-1.8.3...
Installing RDoc documentation for json-1.8.3...
[root@c01 ~]# gem install fpm -v 1.3.3
Building native extensions. This could take a while...
Successfully installed cabin-0.9.0
Successfully installed backports-3.8.0
Successfully installed arr-pm-0.0.10
Successfully installed clamp-0.6.5
Successfully installed ffi-1.9.18
Successfully installed childprocess-0.7.0
Successfully installed fpm-1.3.3
7 gems installed
Installing ri documentation for cabin-0.9.0...
Installing ri documentation for backports-3.8.0...
Installing ri documentation for arr-pm-0.0.10...
Installing ri documentation for clamp-0.6.5...
Installing ri documentation for ffi-1.9.18...
Installing ri documentation for childprocess-0.7.0...
Installing ri documentation for fpm-1.3.3...
Installing RDoc documentation for cabin-0.9.0...
Installing RDoc documentation for backports-3.8.0...
Installing RDoc documentation for arr-pm-0.0.10...
Installing RDoc documentation for clamp-0.6.5...
Installing RDoc documentation for ffi-1.9.18...
Installing RDoc documentation for childprocess-0.7.0...
Installing RDoc documentation for fpm-1.3.3...
gem从rubygem仓库安装软件类似yum从yum仓库安装软件。首先安装低版本的json,高版本的json需要ruby2.0以上,然后安装低版本的fpm,够用就行。

由于没安装rpm-build

yum install rpm-build