Package shell scripts into RPM packages

Source: Internet
Author: User
Tags pack rpmbuild

The next best thing to do on a virtual machine: Docker is the most convenient

1. Installing Rpmbuild

Yum-y Install Rpmbuild rpmdevtools-y

2. Generate a package path

With Rpmdev-setuptree, a Rpmbuild folder is automatically generated in the user's home directory as the working path

CD rpmbuild/specs path, create Filename.spec file (packaged shell script sample), detailed meaning consult related documents

name:nameversion:0.1.0Release:1%{?Dist} Summary: Description License: protocol Group:enterprise/XXX vendor:xxxxrequires: Dependent packages%Description Description%Prep%Files # The file you want to pack and the directory you want to install when you install it%defattr (-,root,root,-) # Default Permissions/etc/abc.SH# files that you want to pack%Doc%Pre%Post%Preun # Action to be taken when the program is unloaded, the file you want to package is not written, and will be removed when uninstalling. You can delete some other files or other operations hereRM-rf/etc/a.confRM-rf/etc/b.conf%changelog

%files can also be packaged under the table

3. Execute the Package command RPMBUILD-BB Filename.spec

Error: Error:file not found:/root/rpmbuild/buildroot/name-0.1.0-1.el6.x86_64/etc/abc.sh. Create the next/root/rpmbuild/manually buildroot/name-0.1.0-1.el6.x86_64/etc/the directory and copy your script over. It's OK to do it again.

The RPM package will be placed under the rpmbuild/rpms/x86_64 path. complete

You can also use the Rpmbuild--buildroot=/dir-bb filename.spec command, where the dir directory is preferably empty, under which you create a directory that you want to package in Filename.spec, and move the file over.

For reference only

Reference Documentation:

Http://www.cnblogs.com/wjoyxt/p/5554004.html

The source package that needs to be compiled is packaged:

Http://jaminzhang.github.io/linux/use-rpmbuild-to-build-custom-RPM-package (the reference link in this article is worth a visit)

http://4270819.blog.51cto.com/4260819/862880

http://murongqingqqq.blog.51cto.com/2902694/1396751

Official documents:

https://fedoraproject.org/wiki/How_to_create_an_RPM_package/zh-cn#.E5.85.B3.E4.BA.8E.E6.9C.AC.E6.8C.87.E5.8D.97

Package shell scripts into RPM packages

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.