Customize your own RPM package with Rpmbuild packaging

Source: Internet
Author: User
Tags openssl nginx server rpmbuild
This is the first technical blog that I wrote on CSDN, because I have recently been working on RPM packaging. Share it today. The advantage of RPM is that installation and post-upgrade are quick and easy, eliminating the need to manually compile the source code again. Save a lot of time. Here the Nginx Server installation package is tested for an instance.

Environment:
1. System: CentOS release 6.5 (Final) x86_64
2. Hardware: KVM virtual machine, dual core cpu,2g memory, 50G HDD
3.user: Using the normal user, the way to login here is: User+key
4. Permissions: Use sudo to use root privileges

Pre-Preparation:
1. Download the latest compressed package: wget http://nginx.org/download/nginx-1.6.0.tar.gz
2. Install the Rpmbuild Compiler Prerequisite tool (group installation): Yum Groupinstall "Development tools"

Start customizing:
1. Build a working directory (you can not build it here, the default tool installation will be built automatically)
[huzhong@s186 ~]$ mkdir Rpmbuild/{build,buildroot,rpms,sources,specs,srpms}
[huzhong@s186 ~]$ CD rpmbuild/specs/
2. Start writing the spec file for the custom pack (the file contents are as follows)
[huzhong@ s186  SPECS]$  cat  nginx. Spec% define  _localstatedir /home% define  nginx_user  nginx% define  nginx_group  ngi NX # distribution specific definitions% define  use_systemd  (0%) Fedora}  &&   0 {? Fedora}  >= )   | |   (0 {) Rhel}  &&  0 {rhel}  >=  7)% if  0 {? Rhel}   ==& nbsp 5 group:  system  environment/daemons Requires (PRE):  shadow-utils requires:  initscripts  >=  8.36 Requires (POST):  chkconfig requires:  OpenSSL buildrequires:  openssl-devel% endif % if  0 {? rhel}   ==  6 group:  system  environment/daemons Requires (pre):  sh Adow-utils requires:  initscripts  >=  8.36 Requires (POST):  chkconfig requires:  OpenSSL   >=  1.0.1 Buildrequires:  openssl-devel  >=  1.0.1% define  with_spdy  1 endif% if  0 {? Rhel}&nb sp;  ==  7 group:  system  environment/daemons Requires (PRE):  shadow-utils Requires:&nbsp ; Systemd requires:  openssl  >=  1.0.1 buildrequires:  systemd buildrequires:  OpenSSL- devel  >=  1.0.1% define  with_spdy  1 endif% if  0 {? suse_version} group:  Produ Ctivity/networking/web/servers buildrequires:  libopenssl-devel Requires (pre):  pwdutils% endif #&nb Sp;end of distribution specific definitions summary:  High  performance  web   Server name:  nginx version:  1.6.0 release:  1 {? dist}. NGX vendor:  nginx  Inc. url:  http://Nginx. org/source0:  http://Nginx. Org/download/% {Name}-% {version}. Tar. GZ source1:  run. SH source2:  nginx. Conflicense:  2-clause  bsd-like  License buildroot: % {_tmppath}/% {name}-% {version}-% {R Elease}-Root buildrequires:  zlib-devel buildrequires:  pcre-devel provides:  webserver% descriptio n nginx  [engine  x]  is  an  http  and  reverse  proxy  server,  AS&N Bsp well  as  a  mail  proxy  server. configure  arguments: % PREP% setup -Q% build. /configure \         --prefix =% {_localstatedir}/nginx \          --Conf-path =% {_localstatedir}/Nginx/conf/nginx. Conf \         --Http-client-body-temp-path =% {_localstatedir}/ Nginx/cache/client_temp \         --Http-proxy-temp-path =% {_l Ocalstatedir}/Nginx/cache/Proxy_temp \         --Http-fastcgi-temp-path =% {_localstatedir}/ Nginx/cache/fastcgi_temp \         --Http-uwsgi-temp-path =% {_ Localstatedir}/nginx/cache/uwsgi_temp \         --http-scgi-temp -Path =% {_localstatedir}/nginx/cache/scgi_temp \         -User =% {nginx_user} \         --group =% {Nginx_group} \          --With-http_ssl_module \          --with-http_realip_module \         --With-http_addition_ Module \         --with-http_sub_module \          --With-http_dav_module \         --with-http_flv_module \          --With-http_gunzip_module \          --with-http_gzip_static_module \         --with-http_random_index_ Module \         --with-http_secure_link_module \          --With-http_stub_status_module \          --with-http_auth_request_module \         --with-mail& Nbsp;\         --with-mail_ssl_module \          --with-file-aio \ make % {? _smp_mflags}% install% {__RM} 

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.