一、說(shuō)明:fpm的功能就是將一種類型的包轉(zhuǎn)換成另一種類型
目前創(chuàng)新互聯(lián)公司已為1000多家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬空間、綿陽(yáng)服務(wù)器托管、企業(yè)網(wǎng)站設(shè)計(jì)、井研網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。fpm支持的源類型包:
???????????????? dir? :將目錄打包成所需要的類型用于源碼編譯安裝的軟件包;
???????????????? rpm:對(duì)rpm進(jìn)行轉(zhuǎn)換;
???????????????? gem:對(duì)rubygem包進(jìn)行轉(zhuǎn)換;
???????????????? python:將python模塊打包成相應(yīng)的類型
fpm支持的目標(biāo)類型包:
???????????????? rpm:轉(zhuǎn)換為rpm包
???????????????? deb:轉(zhuǎn)換為deb包
??????????????? solari:轉(zhuǎn)換為solaris包
??????????????? puppet:轉(zhuǎn)換成pupper包
fpm常用參數(shù):
??????????????? -s:指定源類型;
??????????????? -t:指定目標(biāo)類型,即想要制作什么包;
??????????????? -n:指定包的名字
??????????????? -v:指定包的版本號(hào)
??????????????? -c:??? 指定打包的相對(duì)路徑
??????????????? -d:指定依賴于哪些包;
?????????????? -f:第二次包時(shí)目錄下如果有同名安裝包存在,則覆蓋它;
?????????????? -p:制作的rpm安裝包存放路徑,不指定就在當(dāng)前目錄下;
?????????????? --post-install:軟件包安裝完成之后所要運(yùn)行的腳本;
?????????????? --post-uninstall:軟件包卸載完成之后所要運(yùn)行的腳本;
?????????????? --pre-install:軟件包安裝完成之前所要運(yùn)行的腳本;
?????????????? --pre-uninstall:軟件包卸載完成之前所要運(yùn)行的腳本;
????????????? --prefix:制作好的rpm包默認(rèn)安裝路徑??????????
二、安裝fpm
??????????? #yum install –y ruby rubygems? ruby-devel???????????????????? #安裝fpm前需要先安裝ruby,rubygem;
??????????? #移除原生的ruby倉(cāng)庫(kù),添加淘寶的ruby倉(cāng)庫(kù):
# 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.????? #安裝出現(xiàn)這種錯(cuò)誤,請(qǐng)先安裝ffi,json,同時(shí)也是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時(shí)出現(xiàn)如下錯(cuò)誤,
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
查過(guò)資料,是因?yàn)闆](méi)有安裝zlib-devel的緣故
安裝zlib-devel
#yum install –y zlib-devel
#cd ruby-2.5.3/ext/zlib
#ruby ./extconf.rb???? #當(dāng)這一步出現(xiàn)如下錯(cuò)誤:make: *** No rule to make target `/include/ruby.h', needed by `zlib.o'. Stop.請(qǐng)進(jìn)行這一步操作:
#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/
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。