製作rpm包工具fpm安裝

安裝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-buildpython

yum install rpm-build
相關文章
相關標籤/搜索