可执行文件简单打包成rpm文件

操作环境: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打包文件。

你可能感兴趣的:(linux)