閱讀767 返回首頁    go 阿裏雲 go 技術社區[雲棲]


rpm打包和yum安裝,以及安裝後自啟動

rpmbuild 可以把源文件或者二進製文件打包成rpm包,rpm包可以放到源上進行分發。

執行rpmbuild --showrc  |grep topdir,可以找到rpmbuild 執行的根目錄,

如果僅僅希望給把二進製文件打包成rpm包,那麼把二進製文件放到  $topdir/BUILD/ 目錄下。

編寫${binary}.spec

Summary: client
Name: client
Version: 0.6 
Release: 1
Vendor: company
License: commercial
Group: Applications/Internet
%description
ols client
used to collect logs from client machine
%install
mkdir -p /apsara/binary
install -m 755 binary /apsara/binary
%post
/apsara/binary --_update_address=https://10.230.201.117:8080  --check_update_interval=1 --check_point_time_out=10 --send_address=https://service.ols.inc.com --domain_socket_address=/tmp/xxxxxxxxxxxxxxxxx
%files
/apsara/binary

%install 字段指的是安裝rpm包時執行的命令,

%post字段值得是安裝好rpm包後執行的命令。

編寫好spec文件後,執行rpmbuild -bb binary.spec

就可以得到rpm包了


最後更新:2017-04-03 22:15:39

  上一篇:go 健康心態十則
  下一篇:go eclipse+webservice開發實例