SlideShare a Scribd company logo

RPM Building

1 of 18
RPM Building



© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>
               All Rights Reserved.
What to Expect?
System Setup to build an RPM
Steps to build an RPM
Testing the built RPM




        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   2
                       All Rights Reserved.
Master Steps
Setting up the build system
Collating the package source
Writing the .spec file
Actually building the rpm
Testing the built rpm




         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   3
                        All Rights Reserved.
System Setup
Creating a separate login, say rpmbuild
  To avoid security hazards
Create a package directory
  mkdir <pkg_dir>
Create the following subdirectories
  BUILD: Place for building by rpmbuild
  RPMS with i386, i686, noarch: For built binary package
  SOURCES: For the original software sources
  SPECS: For .spec file
  SRPMS: For built source rpm
  tmp: For temporary files (Optional)
Install the following commands
  rpmbuild: Typically part of rpm-build package
  Other Optionals: rpmlint, gpg

                 © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   4
                                All Rights Reserved.
Steps to Build an RPM
Collating the package sources
  Typically as a .tgz file
Writing a spec file
  Basic structure
  Building the package
  Cleaning the package
  Installing the package
  Uninstalling the package
Building using rpmbuild
          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   5
                         All Rights Reserved.
Locate your Templates
Create the .tgz of sources
  View the 'sources' target in the makefile
  Output: SOURCES/pkg_cmd-1.0.tgz
Spec file & the macros
  Example: SPECS/pkg_cmd-1.0.spec
Building the rpm
  View the 'build' target in the makefile
  Output: RPMS/pkg_cmd-1.0-1.i386.rpm

         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   6
                        All Rights Reserved.
Spec Sections
Introduction
  Defines, Keywords, %description
%prep – Unpack source code
%build – Compile code
% install – Install code onto build machine
%clean – Clean up code
%files – List of files to use
%changelog – Change log of the code
         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   7
                        All Rights Reserved.
%file specific Macros
%defattr – Default attributes
  file attributes, owner, group, dir attributes
%doc – Documentation files
%exclude – Exclude these files
Useful Path Macros
  %{_prefix}
  %{_bindir}, %{_sbindir}, %{_libdir}
  %{_datadir}, %{_sysconfdir}
  %{_mandir}, %{_infodir}
  %{_gamesbindir}, %{_gamesdatadir}
            © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   8
                           All Rights Reserved.
Additional Spec Sections
%pre – Execute before install
%post – Execute after install
%preun – Execute before uninstall
%postun – Execute after uninstall
Option to these: -p <interpreter>




        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   9
                       All Rights Reserved.
Signing an RPM
Assuming that a GPG key is there
Add the following macros in the .spec file
  %_signature gpg
  %_gpg_path /path/to/.gnupg
  %_gpg_name name lastname (comment) <email>
    'gpg --list-keys' to get the value
  %_gpgbin /usr/bin/gpg
Build with --sign option to rpmbuild
Alternatively, an RPM can be signed as follows
  rpm --addsign <rpm_package>
After putting the above macros in ~/.rpmmacros
              © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   10
                             All Rights Reserved.
Interesting Spec Macros
Triggers on operation with other packages
  %triggerin <pkg> – On installing <pkg>
  %triggerun <pkg> – On uninstalling <pkg>
  %triggerin <pkg> – After uninstalling <pkg>
Details about all
  /usr/lib/rpm/macros
Place for repeated macros
  ~/.rpmmacros

         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   11
                        All Rights Reserved.
Building the RPM
Using rpmbuild
 rpmbuild <build_options> [options] <spec_file>
<build_options>
 -bs, bb, -ba
 -bp (%prep), -bc (%build), -bi (%install)
 -bl (list check from %files)
A very clean way
 rpmbuild -ba --rmspec --rmsource
 rpmbuild --rebuild

          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   12
                         All Rights Reserved.
Testing the RPM Build(ing)
Are rpms created in their directories?
Are the rpms with the correct names?
Is the rpm info correct? Issued by
  rpm -qlivp --changelog <rpm_package>
Linting the rpms or even the spec files
  rpmlint [-i] <rpm_package | spec_file>
Install Tests
  Expected files at expected places & privileges
  Binaries executable, Documentation accessible
  Various installs, uninstalls
    On different machines
    Without required packages
                © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   13
                               All Rights Reserved.
Backup




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   14
               All Rights Reserved.
Options to setup
-c – Create upper directory first
  Useful for archive without a parent directory
-D – Does not delete the directory
  Useful in later setups, if multiple
-T – Override the default behaviour
  Rather specified by -a 0, -b 0, etc
-n <name> - <name> what source
unpacks to
  Useful if different from the source name
          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   15
                         All Rights Reserved.
Generating a GPG key
Generate a key using gpg --gen-key
Listings (provides <UID>)
  gpg --list-sigs
  gpg --list-keys
Generating a public key
  gpg --armor --export "<UID>" > my.key.file.asc
Publishing the public key
  gpg --keyserver pgp.mit.edu --send-key "<UID>"


           © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   16
                          All Rights Reserved.
What all have we learnt?
System Setup to build an RPM
Steps to build an RPM
  Collating the sources
  Writing the spec file
  Building the rpm
Testing the built RPM



         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   17
                        All Rights Reserved.
Any Queries?




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   18
               All Rights Reserved.

More Related Content

What's hot (20)

Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
"make" system
"make" system"make" system
"make" system
 
File Systems
File SystemsFile Systems
File Systems
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Processes
ProcessesProcesses
Processes
 
System Calls
System CallsSystem Calls
System Calls
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 
Toolchain
ToolchainToolchain
Toolchain
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
 
Architecture Porting
Architecture PortingArchitecture Porting
Architecture Porting
 
BeagleBone Black Booting Process
BeagleBone Black Booting ProcessBeagleBone Black Booting Process
BeagleBone Black Booting Process
 
References
ReferencesReferences
References
 
Low-level Accesses
Low-level AccessesLow-level Accesses
Low-level Accesses
 
Embedded Storage Management
Embedded Storage ManagementEmbedded Storage Management
Embedded Storage Management
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
USB Drivers
USB DriversUSB Drivers
USB Drivers
 

Similar to RPM Building

Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMAlexander Shopov
 
OSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
OSDC 2013 | Software Packaging with RPM Demystified by Andrew FordOSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
OSDC 2013 | Software Packaging with RPM Demystified by Andrew FordNETWAYS
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC FrameworkBala Kumar
 
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbedDaniel Bimschas
 
Introduction to JumpStart
Introduction to JumpStartIntroduction to JumpStart
Introduction to JumpStartScott McDermott
 
2.5 use rpm and yum package management
2.5 use rpm and yum package management2.5 use rpm and yum package management
2.5 use rpm and yum package managementAcácio Oliveira
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android晓东 杜
 
How to install squid proxy on server or how to install squid proxy on centos o
How to install squid proxy on server  or how to install squid proxy on centos oHow to install squid proxy on server  or how to install squid proxy on centos o
How to install squid proxy on server or how to install squid proxy on centos oProxiesforrent
 
Bringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedoraBringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedoraLalatendu Mohanty
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabSoftware Guru
 
RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)skalaivanibutp
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondNuvole
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package managementAcácio Oliveira
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package managementAcácio Oliveira
 
OpenStack for Centos
OpenStack for CentosOpenStack for Centos
OpenStack for CentosChandan Kumar
 
An Overview of Config4*
An Overview of Config4*An Overview of Config4*
An Overview of Config4*Ciaran McHale
 

Similar to RPM Building (20)

Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
 
OSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
OSDC 2013 | Software Packaging with RPM Demystified by Andrew FordOSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
OSDC 2013 | Software Packaging with RPM Demystified by Andrew Ford
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
 
R sharing 101
R sharing 101R sharing 101
R sharing 101
 
Odoo V8 Installation
Odoo V8 InstallationOdoo V8 Installation
Odoo V8 Installation
 
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
 
Introduction to JumpStart
Introduction to JumpStartIntroduction to JumpStart
Introduction to JumpStart
 
2.5 use rpm and yum package management
2.5 use rpm and yum package management2.5 use rpm and yum package management
2.5 use rpm and yum package management
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
How to install squid proxy on server or how to install squid proxy on centos o
How to install squid proxy on server  or how to install squid proxy on centos oHow to install squid proxy on server  or how to install squid proxy on centos o
How to install squid proxy on server or how to install squid proxy on centos o
 
Bringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedoraBringing-it-all-together-overview-of-rpm-packaging-in-fedora
Bringing-it-all-together-overview-of-rpm-packaging-in-fedora
 
Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)RPM (Red Hat Package Manager)
RPM (Red Hat Package Manager)
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Introduction to Heroku
Introduction to HerokuIntroduction to Heroku
Introduction to Heroku
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
 
101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management101 2.5 use rpm and yum package management
101 2.5 use rpm and yum package management
 
OpenStack for Centos
OpenStack for CentosOpenStack for Centos
OpenStack for Centos
 
An Overview of Config4*
An Overview of Config4*An Overview of Config4*
An Overview of Config4*
 

More from Anil Kumar Pugalia (18)

File System Modules
File System ModulesFile System Modules
File System Modules
 
Processes
ProcessesProcesses
Processes
 
System Calls
System CallsSystem Calls
System Calls
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
 
Power of vi
Power of viPower of vi
Power of vi
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
 
Timers
TimersTimers
Timers
 
Threads
ThreadsThreads
Threads
 
Synchronization
SynchronizationSynchronization
Synchronization
 
Signals
SignalsSignals
Signals
 
Linux Memory Management
Linux Memory ManagementLinux Memory Management
Linux Memory Management
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 

Recently uploaded

Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...
Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...
Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...ShapeBlue
 
Geospatial Synergy: Amplifying Efficiency with FME & Esri
Geospatial Synergy: Amplifying Efficiency with FME & EsriGeospatial Synergy: Amplifying Efficiency with FME & Esri
Geospatial Synergy: Amplifying Efficiency with FME & EsriSafe Software
 
TrustArc Webinar - TrustArc's Latest AI Innovations
TrustArc Webinar - TrustArc's Latest AI InnovationsTrustArc Webinar - TrustArc's Latest AI Innovations
TrustArc Webinar - TrustArc's Latest AI InnovationsTrustArc
 
Communities, networking and developer culture
Communities, networking and developer cultureCommunities, networking and developer culture
Communities, networking and developer cultureRavi Sanghani
 
Q4 2023 Quarterly Investor Presentation - FINAL.pdf
Q4 2023 Quarterly Investor Presentation - FINAL.pdfQ4 2023 Quarterly Investor Presentation - FINAL.pdf
Q4 2023 Quarterly Investor Presentation - FINAL.pdfTejal81
 
eXtended Reality(XR) Basic introductions
eXtended Reality(XR) Basic introductionseXtended Reality(XR) Basic introductions
eXtended Reality(XR) Basic introductionsElanthirayan Madhavan
 
PrismCRM-RealEstate-SalesCRM_byCode5Company
PrismCRM-RealEstate-SalesCRM_byCode5CompanyPrismCRM-RealEstate-SalesCRM_byCode5Company
PrismCRM-RealEstate-SalesCRM_byCode5CompanyMustafa Kuğu
 
VM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlue
VM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlueVM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlue
VM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlueShapeBlue
 
Mastering Play Store App Listing and Optimization
Mastering Play Store App Listing and OptimizationMastering Play Store App Listing and Optimization
Mastering Play Store App Listing and OptimizationAppsthentic Technology
 
Achieving Excellence IESVE for HVAC Simulation.pdf
Achieving Excellence IESVE for HVAC Simulation.pdfAchieving Excellence IESVE for HVAC Simulation.pdf
Achieving Excellence IESVE for HVAC Simulation.pdfIES VE
 
AI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptxAI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptxUdaiappa Ramachandran
 
CloudStack Authentication Methods – Harikrishna Patnala, ShapeBlue
CloudStack Authentication Methods – Harikrishna Patnala, ShapeBlueCloudStack Authentication Methods – Harikrishna Patnala, ShapeBlue
CloudStack Authentication Methods – Harikrishna Patnala, ShapeBlueShapeBlue
 
Artificial Intelligence - AI For Everyone
Artificial Intelligence - AI For EveryoneArtificial Intelligence - AI For Everyone
Artificial Intelligence - AI For EveryoneSridhar Seshadri
 
AGFM - Toyota Coaster 1HZ Install Guide.pdf
AGFM - Toyota Coaster 1HZ Install Guide.pdfAGFM - Toyota Coaster 1HZ Install Guide.pdf
AGFM - Toyota Coaster 1HZ Install Guide.pdfRodneyThomas28
 
Low Latency at Extreme Scale: Proven Practices & Pitfalls
Low Latency at Extreme Scale: Proven Practices & PitfallsLow Latency at Extreme Scale: Proven Practices & Pitfalls
Low Latency at Extreme Scale: Proven Practices & PitfallsScyllaDB
 
Centralized TLS Certificates Management Using Vault PKI + Cert-Manager
Centralized TLS Certificates Management Using Vault PKI + Cert-ManagerCentralized TLS Certificates Management Using Vault PKI + Cert-Manager
Centralized TLS Certificates Management Using Vault PKI + Cert-ManagerSaiLinnThu2
 
Establishing data sharing standards to promote global industry development
Establishing data sharing standards to promote global industry developmentEstablishing data sharing standards to promote global industry development
Establishing data sharing standards to promote global industry developmentThorsten Huelsmann
 
AMER Introduction to ThousandEyes Webinar
AMER Introduction to ThousandEyes WebinarAMER Introduction to ThousandEyes Webinar
AMER Introduction to ThousandEyes WebinarThousandEyes
 
Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...
Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...
Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...2toLead Limited
 

Recently uploaded (20)

Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...
Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...
Elevating Cloud Infrastructure with Object Storage, DRS, VM Scheduling, and D...
 
Geospatial Synergy: Amplifying Efficiency with FME & Esri
Geospatial Synergy: Amplifying Efficiency with FME & EsriGeospatial Synergy: Amplifying Efficiency with FME & Esri
Geospatial Synergy: Amplifying Efficiency with FME & Esri
 
TrustArc Webinar - TrustArc's Latest AI Innovations
TrustArc Webinar - TrustArc's Latest AI InnovationsTrustArc Webinar - TrustArc's Latest AI Innovations
TrustArc Webinar - TrustArc's Latest AI Innovations
 
Communities, networking and developer culture
Communities, networking and developer cultureCommunities, networking and developer culture
Communities, networking and developer culture
 
Q4 2023 Quarterly Investor Presentation - FINAL.pdf
Q4 2023 Quarterly Investor Presentation - FINAL.pdfQ4 2023 Quarterly Investor Presentation - FINAL.pdf
Q4 2023 Quarterly Investor Presentation - FINAL.pdf
 
eXtended Reality(XR) Basic introductions
eXtended Reality(XR) Basic introductionseXtended Reality(XR) Basic introductions
eXtended Reality(XR) Basic introductions
 
Sue Loth: Job Search Strategies using personal connections
Sue Loth: Job Search Strategies using personal connectionsSue Loth: Job Search Strategies using personal connections
Sue Loth: Job Search Strategies using personal connections
 
PrismCRM-RealEstate-SalesCRM_byCode5Company
PrismCRM-RealEstate-SalesCRM_byCode5CompanyPrismCRM-RealEstate-SalesCRM_byCode5Company
PrismCRM-RealEstate-SalesCRM_byCode5Company
 
VM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlue
VM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlueVM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlue
VM Migration from VMware to CloudStack and KVM – Suresh Anaparti, ShapeBlue
 
Mastering Play Store App Listing and Optimization
Mastering Play Store App Listing and OptimizationMastering Play Store App Listing and Optimization
Mastering Play Store App Listing and Optimization
 
Achieving Excellence IESVE for HVAC Simulation.pdf
Achieving Excellence IESVE for HVAC Simulation.pdfAchieving Excellence IESVE for HVAC Simulation.pdf
Achieving Excellence IESVE for HVAC Simulation.pdf
 
AI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptxAI-Plugins-Planners-Persona-SemanticKernel.pptx
AI-Plugins-Planners-Persona-SemanticKernel.pptx
 
CloudStack Authentication Methods – Harikrishna Patnala, ShapeBlue
CloudStack Authentication Methods – Harikrishna Patnala, ShapeBlueCloudStack Authentication Methods – Harikrishna Patnala, ShapeBlue
CloudStack Authentication Methods – Harikrishna Patnala, ShapeBlue
 
Artificial Intelligence - AI For Everyone
Artificial Intelligence - AI For EveryoneArtificial Intelligence - AI For Everyone
Artificial Intelligence - AI For Everyone
 
AGFM - Toyota Coaster 1HZ Install Guide.pdf
AGFM - Toyota Coaster 1HZ Install Guide.pdfAGFM - Toyota Coaster 1HZ Install Guide.pdf
AGFM - Toyota Coaster 1HZ Install Guide.pdf
 
Low Latency at Extreme Scale: Proven Practices & Pitfalls
Low Latency at Extreme Scale: Proven Practices & PitfallsLow Latency at Extreme Scale: Proven Practices & Pitfalls
Low Latency at Extreme Scale: Proven Practices & Pitfalls
 
Centralized TLS Certificates Management Using Vault PKI + Cert-Manager
Centralized TLS Certificates Management Using Vault PKI + Cert-ManagerCentralized TLS Certificates Management Using Vault PKI + Cert-Manager
Centralized TLS Certificates Management Using Vault PKI + Cert-Manager
 
Establishing data sharing standards to promote global industry development
Establishing data sharing standards to promote global industry developmentEstablishing data sharing standards to promote global industry development
Establishing data sharing standards to promote global industry development
 
AMER Introduction to ThousandEyes Webinar
AMER Introduction to ThousandEyes WebinarAMER Introduction to ThousandEyes Webinar
AMER Introduction to ThousandEyes Webinar
 
Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...
Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...
Microsoft x 2toLead Webinar Session 2 - How Employee Learning and Development...
 

RPM Building

  • 1. RPM Building © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  • 2. What to Expect? System Setup to build an RPM Steps to build an RPM Testing the built RPM © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 2 All Rights Reserved.
  • 3. Master Steps Setting up the build system Collating the package source Writing the .spec file Actually building the rpm Testing the built rpm © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 3 All Rights Reserved.
  • 4. System Setup Creating a separate login, say rpmbuild To avoid security hazards Create a package directory mkdir <pkg_dir> Create the following subdirectories BUILD: Place for building by rpmbuild RPMS with i386, i686, noarch: For built binary package SOURCES: For the original software sources SPECS: For .spec file SRPMS: For built source rpm tmp: For temporary files (Optional) Install the following commands rpmbuild: Typically part of rpm-build package Other Optionals: rpmlint, gpg © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 4 All Rights Reserved.
  • 5. Steps to Build an RPM Collating the package sources Typically as a .tgz file Writing a spec file Basic structure Building the package Cleaning the package Installing the package Uninstalling the package Building using rpmbuild © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 5 All Rights Reserved.
  • 6. Locate your Templates Create the .tgz of sources View the 'sources' target in the makefile Output: SOURCES/pkg_cmd-1.0.tgz Spec file & the macros Example: SPECS/pkg_cmd-1.0.spec Building the rpm View the 'build' target in the makefile Output: RPMS/pkg_cmd-1.0-1.i386.rpm © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 6 All Rights Reserved.
  • 7. Spec Sections Introduction Defines, Keywords, %description %prep – Unpack source code %build – Compile code % install – Install code onto build machine %clean – Clean up code %files – List of files to use %changelog – Change log of the code © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 7 All Rights Reserved.
  • 8. %file specific Macros %defattr – Default attributes file attributes, owner, group, dir attributes %doc – Documentation files %exclude – Exclude these files Useful Path Macros %{_prefix} %{_bindir}, %{_sbindir}, %{_libdir} %{_datadir}, %{_sysconfdir} %{_mandir}, %{_infodir} %{_gamesbindir}, %{_gamesdatadir} © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 8 All Rights Reserved.
  • 9. Additional Spec Sections %pre – Execute before install %post – Execute after install %preun – Execute before uninstall %postun – Execute after uninstall Option to these: -p <interpreter> © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
  • 10. Signing an RPM Assuming that a GPG key is there Add the following macros in the .spec file %_signature gpg %_gpg_path /path/to/.gnupg %_gpg_name name lastname (comment) <email> 'gpg --list-keys' to get the value %_gpgbin /usr/bin/gpg Build with --sign option to rpmbuild Alternatively, an RPM can be signed as follows rpm --addsign <rpm_package> After putting the above macros in ~/.rpmmacros © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 10 All Rights Reserved.
  • 11. Interesting Spec Macros Triggers on operation with other packages %triggerin <pkg> – On installing <pkg> %triggerun <pkg> – On uninstalling <pkg> %triggerin <pkg> – After uninstalling <pkg> Details about all /usr/lib/rpm/macros Place for repeated macros ~/.rpmmacros © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 11 All Rights Reserved.
  • 12. Building the RPM Using rpmbuild rpmbuild <build_options> [options] <spec_file> <build_options> -bs, bb, -ba -bp (%prep), -bc (%build), -bi (%install) -bl (list check from %files) A very clean way rpmbuild -ba --rmspec --rmsource rpmbuild --rebuild © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 12 All Rights Reserved.
  • 13. Testing the RPM Build(ing) Are rpms created in their directories? Are the rpms with the correct names? Is the rpm info correct? Issued by rpm -qlivp --changelog <rpm_package> Linting the rpms or even the spec files rpmlint [-i] <rpm_package | spec_file> Install Tests Expected files at expected places & privileges Binaries executable, Documentation accessible Various installs, uninstalls On different machines Without required packages © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 13 All Rights Reserved.
  • 14. Backup © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 14 All Rights Reserved.
  • 15. Options to setup -c – Create upper directory first Useful for archive without a parent directory -D – Does not delete the directory Useful in later setups, if multiple -T – Override the default behaviour Rather specified by -a 0, -b 0, etc -n <name> - <name> what source unpacks to Useful if different from the source name © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 15 All Rights Reserved.
  • 16. Generating a GPG key Generate a key using gpg --gen-key Listings (provides <UID>) gpg --list-sigs gpg --list-keys Generating a public key gpg --armor --export "<UID>" > my.key.file.asc Publishing the public key gpg --keyserver pgp.mit.edu --send-key "<UID>" © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 16 All Rights Reserved.
  • 17. What all have we learnt? System Setup to build an RPM Steps to build an RPM Collating the sources Writing the spec file Building the rpm Testing the built RPM © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 17 All Rights Reserved.
  • 18. Any Queries? © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 18 All Rights Reserved.