您好,登錄后才能下訂單哦!
【fpm】--需要ruby 1.8.7版本以上,這個是當一個軟件通過源碼形式安裝好了之后在用fpm進行封裝成rpm的
直接去官網下載1.8.7版本以上的ruby源碼包,然后安裝
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.bz2
tar -xf ruby-1.8.7.tar.bz2
./configure && make && make install
ruby -v,看看版本信息對不對
#make的時候會出錯:
make: *** [math.o] Error 1
修改math.c,把37行的define改成defined就行了,然后繼續Make
【gem】--接下來安裝gem
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
解壓后,進入目錄,執行 ruby setup.rb 進行安裝
gem update --system
# 添加淘寶的Ruby倉庫
gem sources -a http://ruby.taobao.org/
# 移除原生的Ruby倉庫
gem sources --remove http://rubygems.org/
# 安裝fpm
gem install fpm
# gem sources -l
*** CURRENT SOURCES ***
http://ruby.taobao.org # 請確保只有 ruby.taobao.org
如果有其他url的話,則用remove把它移除
先說明一下,FPM打包路徑是相對路徑,這個我搗鼓半天才弄明白,比如,我打包這臺機器編譯好的mysql目錄是在/usr/local/mysql下,如果你想讓打出來的rpm包在其他機器上安裝路徑是/usr/local/mysql,那么你就:
2.fpm的常用命令格式
$ fpm -s -t [options]
source type:dir,rpm,gem,python
target type:rpm,deb,solaris,puppet
常用的options:
-n 生成的package名字
-p 生成的package文件輸出位置
-v 生成的package版本
-d 生成的package依賴于什么軟件,通常為-d 'name' 或這 -d 'name > version'
-a 系統架構名稱,如果是noarch則為'-a all' 或者 '-a native'
--description 軟件包描述
--conflicts 與其他什么軟件沖突
fpm -f -s dir -t rpm --epoch 5 --iteration 1.el6 -v 5.3.16 -n php_5.3 -C / -p /root --verbose --category 'Development/Languages' --description 'php-5.3' --url 'php.net' --license 'BSD' -m 'inbank' usr/local/php/
Setting from flags: category=Development/Languages {:level=>:info}
Setting from flags: description=navy mysql {:level=>:info}
Setting from flags: epoch=5 {:level=>:info}
Setting from flags: iteration=1.el6 {:level=>:info}
Setting from flags: license=BSD {:level=>:info}
Setting from flags: maintainer=navy {:level=>:info}
Setting from flags: name=php_5.3 {:level=>:info}
Setting from flags: url=kingsoft.com {:level=>:info}
Setting from flags: version=5.5.16 {:level=>:info}
Converting dir to rpm {:level=>:info}
Reading template {:level=>:info, :path=>"/usr/local/lib/ruby/gems/1.8/gems/fpm-0.4.39/templates/rpm.erb"}
Running rpmbuild {:level=>:info, :args=>["rpmbuild", "-bb", "--define", "buildroot /tmp/package-rpm-build20130712-23168-1i209n6/BUILD", "--define", "_topdir /tmp/package-rpm-build20130712-23168-1i209n6", "--define", "_sourcedir /tmp/package-rpm-build20130712-23168-1i209n6", "--define", "_rpmdir /tmp/package-rpm-build20130712-23168-1i209n6/RPMS", "/tmp/package-rpm-build20130712-23168-1i209n6/SPECS/php_5.3.spec"]}
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.74227 {:level=>:info}
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.74227 {:level=>:info}
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.74227 {:level=>:info}
Processing files: php_5.3-5.5.16-1.el6 {:level=>:info}
Wrote: /tmp/package-rpm-build20130712-23168-1i209n6/RPMS/x86_64/php_5.3-5.5.16-1.el6.x86_64.rpm {:level=>:info}
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.55341 {:level=>:info}
Created rpm {:path=>"/root"}
[root@client /]# ll /root/
[root@client /]# ll /root/ |grep php
-rw-r--r-- 1 root root 13512860 Jul 12 17:06 php_5.3-5.5.16-1.el6.x86_64.rpm
[root@client ~]# rpm -qpi php_5.3-5.3.36-1.el6.x86_64.rpm
Name : php_5.3 Relocations: /
Version : 5.3.36 Vendor: root@client
Release : 1.el6 Build Date: Fri 12 Jul 2013 06:16:48 PM CST
Install Date: (not installed) Build Host: client
Group : Development/Languages Source RPM: php_5.3-5.3.36-1.el6.src.rpm
Size : 46383231 License: BSD
Signature : (none)
Packager : inbank
URL : pp
Summary : php-5.3
Description :
php-5.3
【錯誤】
Need executable 'rpmbuild' to convert dir to rpm {:level=>:error}
--出現這種情況就是需要安裝rpm-build
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。