网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

linux下使用fpm封装制作rpm包

系统运维

一、说明:fpm的功能就是将一种类型的包转换成另一种类型

创新互联长期为成百上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为青铜峡企业提供专业的做网站、网站设计青铜峡网站改版等技术服务。拥有10余年丰富建站经验和众多成功案例,为您定制开发。

         fpm支持的源类型包:

                            dir  :将目录打包成所需要的类型用于源码编译安装的软件包;

                            rpm:对rpm进行转换;

                            gem:对rubygem包进行转换;

                            python:将python模块打包成相应的类型

         fpm支持的目标类型包:

                            rpm:转换为rpm包

                            deb:转换为deb包

                           solari:转换为solaris包

                           puppet:转换成pupper包

         fpm常用参数:

                           -s:指定源类型;

                           -t:指定目标类型,即想要制作什么包;

                           -n:指定包的名字

                           -v:指定包的版本号

                           -c:    指定打包的相对路径

                           -d:指定依赖于哪些包;

                          -f:第二次包时目录下如果有同名安装包存在,则覆盖它;

                          -p:制作的rpm安装包存放路径,不指定就在当前目录下;

                          --post-install:软件包安装完成之后所要运行的脚本;

                          --post-uninstall:软件包卸载完成之后所要运行的脚本;

                          --pre-install:软件包安装完成之前所要运行的脚本;

                          --pre-uninstall:软件包卸载完成之前所要运行的脚本;

                         --prefix:制作好的rpm包默认安装路径          

  二、安装fpm

                       #yum install –y ruby rubygems  ruby-devel                     #安装fpm前需要先安装ruby,rubygem;

                       #移除原生的ruby仓库,添加淘宝的ruby仓库:

            # gem sources --add http://gems.ruby-china.com/ --remove http://rubygems.org/

                          http://gems.ruby-china.com/ added to sources

                           http://rubygems.org/ removed from sources

           [root@jump ~]# gem sources -l

                        *** CURRENT SOURCES ***

                         http://gems.ruby-china.com/

             [root@jump ~]# gem install fpm

               ERROR: Error installing fpm:

                  ffi requires Ruby version >= 1.9.      #安装出现这种错误,请先安装ffi,json,同时也是ruby版本太低的缘故了;

                #gem install json –v 1.8.0

                #gem install ffi  -v 1.9.18

               #wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.gz

#tar xf ruby-2.5.3.tar.gz

            #cd ruby-2.5.3

             #./configure –prefix=/usr/local/ruby

            #make && make install

           #echo “export PATH=$PATH:/usr/local/ruby/bin” >>/etc/profile

          #source /etc/profile

[root@jump ruby-2.5.3]# gem install fpm                    #安装fpm时出现如下错误,

ERROR: Loading command: install (LoadError)

cannot load such file -- zlib

ERROR: While executing gem ... (NoMethodError)

undefined method `invoke_with_build_args\' for nil:NilClass

查过资料,是因为没有安装zlib-devel的缘故

安装zlib-devel

#yum install –y zlib-devel

#cd ruby-2.5.3/ext/zlib

#ruby ./extconf.rb     #当这一步出现如下错误:make: *** No rule to make target `/include/ruby.h\', needed by `zlib.o\'. Stop.请进行这一步操作:

#vim  ruby-2.5.3/ext/zlib/Makefile

#zlib.o: $(top_srcdir)/include/ruby.h #把这一行替换成下面一行

zlib.o: ../../include/ruby.h

#make  && make install

#gem install fpm

Fetching: stud-0.0.23.gem (100%)

Successfully installed stud-0.0.23

Fetching: cabin-0.9.0.gem (100%)

Successfully installed cabin-0.9.0

Fetching: clamp-1.0.1.gem (100%)

Successfully installed clamp-1.0.1

Fetching: mustache-0.99.8.gem (100%)

Successfully installed mustache-0.99.8

Fetching: insist-1.0.0.gem (100%)

Successfully installed insist-1.0.0

Fetching: dotenv-2.5.0.gem (100%)

Successfully installed dotenv-2.5.0

Fetching: pleaserun-0.0.30.gem (100%)

Successfully installed pleaserun-0.0.30

Fetching: ffi-1.9.25.gem (100%)

Building native extensions. This could take a while...

Successfully installed ffi-1.9.25

Fetching: io-like-0.3.0.gem (100%)

Successfully installed io-like-0.3.0

Fetching: ruby-xz-0.2.3.gem (100%)

Successfully installed ruby-xz-0.2.3

Fetching: childprocess-0.9.0.gem (100%)

Successfully installed childprocess-0.9.0

Fetching: arr-pm-0.0.10.gem (100%)

Successfully installed arr-pm-0.0.10

Fetching: backports-3.11.4.gem (100%)

Successfully installed backports-3.11.4

Fetching: json-1.8.6.gem (100%)

Building native extensions. This could take a while...

Successfully installed json-1.8.6

Successfully installed fpm-1.10.2

Parsing documentation for stud-0.0.23

Installing ri documentation for stud-0.0.23

Parsing documentation for cabin-0.9.0

Installing ri documentation for cabin-0.9.0

Parsing documentation for clamp-1.0.1

Installing ri documentation for clamp-1.0.1

Parsing documentation for mustache-0.99.8

Installing ri documentation for mustache-0.99.8

Parsing documentation for insist-1.0.0

Installing ri documentation for insist-1.0.0

Parsing documentation for dotenv-2.5.0

Installing ri documentation for dotenv-2.5.0

Parsing documentation for pleaserun-0.0.30

Installing ri documentation for pleaserun-0.0.30

Parsing documentation for ffi-1.9.25

Installing ri documentation for ffi-1.9.25

Parsing documentation for io-like-0.3.0

Installing ri documentation for io-like-0.3.0

Parsing documentation for ruby-xz-0.2.3

Installing ri documentation for ruby-xz-0.2.3

Parsing documentation for childprocess-0.9.0

Installing ri documentation for childprocess-0.9.0

Parsing documentation for arr-pm-0.0.10

Installing ri documentation for arr-pm-0.0.10

Parsing documentation for backports-3.11.4

Installing ri documentation for backports-3.11.4

Parsing documentation for json-1.8.6

Installing ri documentation for json-1.8.6

Parsing documentation for fpm-1.10.2

Installing ri documentation for fpm-1.10.2

Done installing documentation for stud, cabin, clamp, mustache, insist, dotenv, pleaserun, ffi, io-like, ruby-xz, childprocess, arr-pm, backports, json, fpm after 28 seconds

15 gems installed

至此fpm安装成功了;

三、打包:

  # fpm -s dir -t rpm -n nginx -v 1.14.1 -d \'pcre-devel,openssl-devel\' --post-install /server/scripts/nginx_rpm.sh -f /application/nginx-1.14.1/


网页题目:linux下使用fpm封装制作rpm包
当前链接:http://bjjierui.cn/article/cgpgdd.html

其他资讯