RPM Package Manager for Fedora and CentOS

What is RPM?
RPM is the “RPM Package Manager”
Previously “RedHat Package Manager”
Package manager for Red Hat Linux
Now used by many distributions
RHEL and Centos
Fedora
SUSE
Mandriva
This talk will concentrate on Fedora and Centos
Package Management Basics
 
Why use package management?
OpenBSD base doesn’t
Most Linux systems do
Keeps track of system packages
Files
Descriptions
Checksums
Other…
Allows easy upgrades and uninstalls
RPM Package Management Basics
Developed by Redhat
Dominant distribution at the time was Slackware
Slackware has packages, but not really a package
management system
RPM was a big advance over Slackware
Current stable version is 4.1
Most commonly used version today is 4.0.x
We will be covering 4.0.x
RPM Package Concepts
Pristine Sources
Most Linux software downloaded from the
Internet
Any distribution specific customizations should be
kept separately in patches
Makes it easier to handle new versions
Reproducible Builds
Building and packaging should be easy and
reproducible
Shell script automation
Distributing RPMs
An RPM is distributed as a single file
package_name-version.rpm
Also a source RPM
package_name-version.src.rpm
Contains source and build instructions
Install with command line program
rpm -i package_name-version.rpm
Or, more usually,
rpm -Uvh package_name-version.rpm
Problems With rpm
Dependency hell
Each RPM contains a list of required RPMs
Won't install if requirements are missing
Warns of missing requirements
But won't install them
Better to use 
yum
 instead
yum
YellowDog Updater Modified
yum install package-name
No need to specify version
Installs latest version
Traces dependency tree
Downloads and installs all requirements
A bit like 
apt-get
Advantages of RPMs
Dependency resolution
Easy distribution
Standard installation method
Uninstall simply (
rpm -e
)
Built-in versioning
Command line tools
Tools to query RPM database
Finding RPMs
RPMs are usually distributed from online
repositories
yum is configured to work with these
repositories
List available Perl RPMs
yum list available 'perl-*'
Install chosen RPM
yum install perl-Calendar-Simple
Yum Repositories for Fedora
Many Perl RPMs in the default Fedora
repository
Over 900 packages available
More packages added all the time
Fedora Perl developers mailing list
https://www.redhat.com/mailman/listinfo/fedora-
perl-devel-list
Latest Repository News
Dag, Dries and a couple of smaller
repositories have joined forces to form
RPMForge
http://rpmforge.net/
Currently supports Centos but not Fedora
RPM Repo - https://rpmrepo.org/
Will eventually will combine RPMs from ATrpms,
Dag, Dries and others
Outline
Package Management Basics
RPM Package Management Basics
Creating Your Own RPM Packages
Creating RPM Packages of Downloaded
Programs
Advanced RPM Packaging
Common RPM Installation Commands
Installation
rpm –ihv <package name>
Upgrade
rpm –Uhv <package name>
Freshen
rpm –Fhv <package names…>
Erase
rpm –e <package name>
Other Common RPM Commands
Query
rpm –q[option] <package name>
-qi = Query Package Information
-ql = List Package Files
-qf = Query which package a file belongs to.
--queryformat – Construct Special Query
--querytags – List available tags
-p – Specify non-installed rpm package
-a – Query 
all
 installed files
Other Common RPM Commands
Verify
rpm –V[option] <package name>
Compare information about installed package files with
information stored in rpm database and note any
discrepencies.
Compares size, MD5 sum, permissions, type, owner,
and group of each package file
Signature checking
rpm {-K|--checksig} <package name>
Checks package gpg/pgp signature
Conversion to cpio
rpm2cpio cpio converts rpm files to cpio streams
Setting up the RPM Build Environment
NEVER BUILD RPMs AS ROOT!!!
~/.rpmmacros
%_topdir /path/to/rpm/build/env
I typically use ~/RPM
Optional temp directory
%_tmppath /path/to/tmp
Create directories
~/RPM/BUILD
~/RPM/RPMS/<arch>
~/RPM/RPMS/noarch
~/RPM/SOURCES
~/RPM/SPECS
~/RPM/SRPMS
Creating Your Own RPMs
rpmbuild command
rpmbuild –ba  –  build binary and source rpms
rpmbuild –bb  –  build binary rpm
rpmbuild –bs  –  build source rpm
Before version 4, the rpm command was used
instead of rpmbuild.
Compatibility aliases in 4.0
Aliases removed in 4.1 (Redhat 8.0)
Need source files, patches (if any) and a 
spec
 file.
Source and patch files go in SOURCES/
Spec file goes in SPECS/
RPM Spec Files
Instructions for building and packaging an rpm.
Building – set of shell scripts
Packaging – General info, lists of files, etc.
Divided into sections
Headers (unlabeled section)
%description
%prep
%build
%install
%files
Others
Slide Note
Embed
Share

RPM (Red Hat Package Manager) is a critical package management system used by various Linux distributions like Fedora and CentOS. It simplifies software handling by tracking system packages, facilitating easy upgrades, and ensuring reproducible builds. This technology overview delves into RPM basics, concepts, distribution, drawbacks, and advantages, shedding light on its role in modern Linux ecosystems.

  • RPM Package Manager
  • Fedora
  • CentOS
  • Package Management
  • Linux Ecosystem

Uploaded on Sep 29, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. What is RPM? RPM is the RPM Package Manager Previously RedHat Package Manager Package manager for Red Hat Linux Now used by many distributions RHEL and Centos Fedora SUSE Mandriva This talk will concentrate on Fedora and Centos

  2. Package Management Basics Why use package management? OpenBSD base doesn t Most Linux systems do Keeps track of system packages Files Descriptions Checksums Other Allows easy upgrades and uninstalls

  3. RPM Package Management Basics Developed by Redhat Dominant distribution at the time was Slackware Slackware has packages, but not really a package management system RPM was a big advance over Slackware Current stable version is 4.1 Most commonly used version today is 4.0.x We will be covering 4.0.x

  4. RPM Package Concepts Pristine Sources Most Linux software downloaded from the Internet Any distribution specific customizations should be kept separately in patches Makes it easier to handle new versions Reproducible Builds Building and packaging should be easy and reproducible Shell script automation

  5. Distributing RPMs An RPM is distributed as a single file package_name-version.rpm Also a source RPM package_name-version.src.rpm Contains source and build instructions Install with command line program rpm -i package_name-version.rpm Or, more usually, rpm -Uvh package_name-version.rpm

  6. Problems With rpm Dependency hell Each RPM contains a list of required RPMs Won't install if requirements are missing Warns of missing requirements But won't install them Better to use yum instead

  7. yum YellowDog Updater Modified yum install package-name No need to specify version Installs latest version Traces dependency tree Downloads and installs all requirements A bit like apt-get

  8. Advantages of RPMs Dependency resolution Easy distribution Standard installation method Uninstall simply (rpm -e) Built-in versioning Command line tools Tools to query RPM database

  9. Finding RPMs RPMs are usually distributed from online repositories yum is configured to work with these repositories List available Perl RPMs yum list available 'perl-*' Install chosen RPM yum install perl-Calendar-Simple

  10. Yum Repositories for Fedora Many Perl RPMs in the default Fedora repository Over 900 packages available More packages added all the time Fedora Perl developers mailing list https://www.redhat.com/mailman/listinfo/fedora- perl-devel-list

  11. Latest Repository News Dag, Dries and a couple of smaller repositories have joined forces to form RPMForge http://rpmforge.net/ Currently supports Centos but not Fedora RPM Repo - https://rpmrepo.org/ Will eventually will combine RPMs from ATrpms, Dag, Dries and others

  12. Outline Package Management Basics RPM Package Management Basics Creating Your Own RPM Packages Creating RPM Packages of Downloaded Programs Advanced RPM Packaging

  13. Common RPM Installation Commands Installation rpm ihv <package name> Upgrade rpm Uhv <package name> Freshen rpm Fhv <package names > Erase rpm e <package name>

  14. Other Common RPM Commands Query rpm q[option] <package name> -qi = Query Package Information -ql = List Package Files -qf = Query which package a file belongs to. --queryformat Construct Special Query --querytags List available tags -p Specify non-installed rpm package -a Query all installed files

  15. Other Common RPM Commands Verify rpm V[option] <package name> Compare information about installed package files with information stored in rpm database and note any discrepencies. Compares size, MD5 sum, permissions, type, owner, and group of each package file Signature checking rpm {-K|--checksig} <package name> Checks package gpg/pgp signature Conversion to cpio rpm2cpio cpio converts rpm files to cpio streams

  16. Setting up the RPM Build Environment NEVER BUILD RPMs AS ROOT!!! ~/.rpmmacros %_topdir /path/to/rpm/build/env I typically use ~/RPM Optional temp directory %_tmppath /path/to/tmp Create directories ~/RPM/BUILD ~/RPM/RPMS/<arch> ~/RPM/RPMS/noarch ~/RPM/SOURCES ~/RPM/SPECS ~/RPM/SRPMS

  17. Creating Your Own RPMs rpmbuild command rpmbuild ba build binary and source rpms rpmbuild bb build binary rpm rpmbuild bs build source rpm Before version 4, the rpm command was used instead of rpmbuild. Compatibility aliases in 4.0 Aliases removed in 4.1 (Redhat 8.0) Need source files, patches (if any) and a spec file. Source and patch files go in SOURCES/ Spec file goes in SPECS/

  18. RPM Spec Files Instructions for building and packaging an rpm. Building set of shell scripts Packaging General info, lists of files, etc. Divided into sections Headers (unlabeled section) %description %prep %build %install %files Others

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#