Making RPM Packages

Source: Internet
Author: User
Tags rpmbuild

[Email protected] ~]#  yum install pcre-devel zlib-devel openssl-devel make cmake gcc gcc-c++ bison ncurses-devel rpm- Build Rpmdevtools-y[[email protected] ~]# rpmdev-setuptree# Direct execution Rpmdev-setuptree creates a new working directory and a. rpmmacros file [email Protected] ~]# cat Rpmmacros%_topdir      % (echo $HOME)/rpmbuild%_smp_mflags  -j3%__arch_install_post   /usr/ Lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot

Download source package to: source

[Email protected] x86_64]# ls/root/rpmbuild/build  buildroot  RPMS SOURCES  SPECS  SRPMS

[Email protected] x86_64]# ls/root/rpmbuild/sources/nginx-1.4.4.tar.gz  nginx.conf

Making Xxx.spec files in specs

[[email protected] x86_64]# Ls/root/rpmbuild/specs/nginx.spec[[email  protected] x86_64]# cat/root/rpmbuild/specs/nginx.specname:nginxversion:1.4.4release:1%{?dist}summary: Nginx RMP Package productiongroup:applications/archivinglicense:gplv2url:http://www.nginx.orgsource:http:// Nginx.org/download/nginx-1.4.4.tar.gzbuildroot:% (Mktemp-ud%{_tmppath}/%{name}-%{version}-%{release}-xxxxxx) Buildrequires:gccrequires:openssl,openssl-devel,pcre-devel,pcre%descriptioncustom nginx rpm PACKAGE%PREPRM-RF $RPM _build_dir/nginx-1.4.4tar FX $RPM _SOURCE_DIR/NGINX-1.4.4.TAR.GZ%BUILDCD nginx-1.4.4./configure--user=www--group= www--prefix=/home/application/nginx--with-http_ssl_module--with-http_stub_status_module--with-http_gzip_static _modulemake%{?_smp_mflags}%installrm-rf%{buildroot}cd nginx-1.4.4make Install DESTDIR=%{BUILDROOT}%CLEANRM-RF%{ Buildroot}%files%defattr (-,root,root,-)/home/application/nginx 

Xxx.spec File Explanation:

#: Starting with # is a comment, and RPM ignores it. Summary:   simple description software. Name:    defines the names of the RPMs. Version:   define software version release:   release version License:   define license Group:    Software Classification Source:   Source URL:      Source related website distribution : Release Series Packager: Packager information%description: Detailed description of the software, can be multi-line%prep: The process before the software compilation, such as decompression. %build: Start compiling software, such as Make%install: Start installing software, such as Make Install%files: Specify which files need to be packaged, such as/usr/local/nginx%preun: Define actions prior to uninstallation, such as killing processes.

Start Making:

[Email protected] x86_64]# RPMBUILD-BB  /root/rpmbuild/specs/nginx.spec

To generate the RPM package:

[Email protected] x86_64]# tree/root/rpmbuild/rpms//root/rpmbuild/rpms/└──x86_64    ├──nginx-1.4.4-1.el6.x86_ 64.rpm    └──nginx-debuginfo-1.4.4-1.el6.x86_64.rpm1 directory, 2 files

Making RPM Packages

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.