可執行檔案簡單打包成rpm檔案
阿新 • • 發佈:2019-01-08
操作環境:CentOS_6.7-Minimal
首先安裝rpm環境:
yum install rpm-build
yum install rpm-devel
yum install rpmdevtools
生成rpm執行環境:
rpmdev-setuptree
這時在root目錄下會有rpmbuild檔案,進入/root/rpmbuild/SPECS/,編輯打包指令碼test.spec
Name: test
Version: 1.1.1
Release: 0
Summary: test
Group: System Environment/Daemons
License: GPL
Vendor: MySelf.com
%description
%pre
%preun
%postun
%clean
%files
%defattr (-,root,root,0777)
/usr/local/test
/etc/init.d/testctl
%post
chmod +x /etc/init.d/testctl
/sbin/chkconfig -add testctl
/sbin/chkconfig testctl on
將要打包的檔案複製到rpmbuild/BUILDROOT/test-1.1.1-0.x86_64/usr/local/test目錄下,
然後執行
rpmbuild -ba test.spec
此時在rpmbuild/RPMS/x86_64/目錄會生成rpm打包檔案。