rpm
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rpm [2012/04/12 19:04] – [SPEC file sections explained] k2patel | rpm [2020/08/10 02:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== RPM ====== | ====== RPM ====== | ||
+ | |||
+ | * [[ Python packages to rpm ]] | ||
Package management system few tips / trick to build / modify / work with packages. \\ | Package management system few tips / trick to build / modify / work with packages. \\ | ||
Many hints information taken from original site [[http:// | Many hints information taken from original site [[http:// | ||
+ | ==== RPM Common Command ==== | ||
+ | |||
+ | ^ Syntax ^Description^ | ||
+ | | rpm -ivh {rpm-file} | Install the package | | ||
+ | | rpm -Uvh {rpm-file} | Upgrade package | | ||
+ | | rpm -ev {package} | Erase/ | ||
+ | | rpm -ev --nodeps {package} | Erase/ | ||
+ | | rpm -qa | Display list all installed packages | | ||
+ | | rpm -qi {package} | Display installed information along with package version and short description | | ||
+ | | rpm -qf {/ | ||
+ | | rpm -qc {pacakge-name} | Display list of configuration file(s) for a package | | ||
+ | | rpm -qcf {/ | ||
+ | | rpm -qa --last | Display list of all recently installed RPMs | | ||
+ | | rpm -qpR {.rpm-file} | Find out what dependencies a rpm file has | | ||
+ | | rpm -qR {package} | ::: | | ||
+ | | rpm -qR bash | ::: | | ||
==== How to Print .spec file from RPM ==== | ==== How to Print .spec file from RPM ==== | ||
Line 125: | Line 143: | ||
</ | </ | ||
+ | ==== Something i come across ==== | ||
+ | If you wanna override marco from OS you can define value at '' | ||
+ | <code bash> | ||
+ | %define _mandir /usr/man | ||
+ | </ | ||
==== Sample RPM ==== | ==== Sample RPM ==== | ||
<code bash | sample.spec> | <code bash | sample.spec> | ||
Line 216: | Line 239: | ||
[[http:// | [[http:// | ||
+ | ==== Scriptlets ==== | ||
+ | |||
+ | Normally, rpm has scriptlets inside the spec file that are | ||
+ | ran at install time. These are: | ||
+ | <code bash> | ||
+ | %pre - Run before rpm files are installed. | ||
+ | %post | ||
+ | %preun | ||
+ | %postun | ||
+ | | ||
+ | %triggerun | ||
+ | %triggerpostun | ||
+ | </ | ||
+ | The scripts are normally bash scripts, but you can change the interpreter | ||
+ | with the -p option. | ||
+ | |||
+ | Also, as they are bash scripts you can call external scripts from these. | ||
==== General RPM Command ==== | ==== General RPM Command ==== | ||
Line 223: | Line 263: | ||
</ | </ | ||
+ | |||
+ | ==== Error on Building ==== | ||
+ | === module: command not found === | ||
+ | Try running following command and then execute rpmbuild will resolve the issue. | ||
+ | <code bash> | ||
+ | source / | ||
+ | </ | ||
==== MOCK ==== | ==== MOCK ==== | ||
Line 267: | Line 314: | ||
</ | </ | ||
+ | == Building SRPM == | ||
+ | <code bash> | ||
+ | mock -r epel-6-x86_64 --spec icinga-web.spec --sources=../ | ||
+ | </ | ||
==== Copying Files ==== | ==== Copying Files ==== | ||
<note important> | <note important> | ||
Line 292: | Line 343: | ||
In general case result will be stored in '/ | In general case result will be stored in '/ | ||
- | ==== RPM Spec File Information | + | ==== SPEC file Overview |
This is mostly from following URL [[http:// | This is mostly from following URL [[http:// | ||
<code text> | <code text> | ||
- | SPEC file overview | ||
Other useful guides: | Other useful guides: | ||
Line 772: | Line 822: | ||
</ | </ | ||
- | ^ Macro ^Typical Expansion ^ Meaning ^ | + | |
- | | %{_bindir} | / | + | ^ Macro ^ Typical Expansion ^ Meaning ^ |
- | | %{_builddir} | ~/ | + | | %{_bindir} | /usr/bin | Binary directory: where executables are usually stored. | |
- | | %{buildroot} | ~/ | + | | %{_builddir} | ~/ |
- | | %{buildsubdir}| | + | | %{buildroot} | ~/ |
- | | %{_datadir} | / | + | | %{buildsubdir} | %{_builddir}/ |
- | | %{_defaultdocdir}| | + | | %{_datadir} | /usr/share | Share directory. | |
- | | %{dist} | .fcNUMBER | | + | | %{_defaultdocdir} | / |
- | | %{fedora} | NUMBER | | + | | %{dist} | .fcNUMBER | Distribution+version short name (e.g. " |
- | | %{_includedir}| | + | | %{fedora} | NUMBER | Number of fedora release (e.g. " |
- | | %{_infodir} | / | + | | %{_includedir} | / |
- | | %{_initrddir} | / | + | | %{_infodir} | / |
- | | %{_libdir} | / | + | | %{_initrddir} | / |
- | | %{_libexecdir}| | + | | %{_libdir} | /usr/lib | | |
- | | %{_localstatedir}| | + | | %{_libexecdir} | / |
- | | %{_mandir} | / | + | | %{_localstatedir} | /var | | |
- | | %{name} | | Name of package, set by Name: tag | | + | | %{_mandir} | / |
- | | %{_sbindir} | / | + | | %{name} | |
- | | %{_sharedstatedir}| | + | | %{_sbindir} | /usr/sbin | | |
- | | %{_sysconfdir}| | + | | %{_sharedstatedir} | /var/lib | | |
- | | %{version} | | + | | %{_sysconfdir} | /etc | | |
+ | | %{version} | | Version of package, set by Version: tag | | ||
+ | |||
+ | |||
<code text> | <code text> | ||
+ | Learn more about macros by looking in /etc/rpm/* and / | ||
+ | Also use rpm --showrc to show values that RPM will use for macros (altered by rpmrc and macro configuration files). | ||
+ | |||
You can set your own macro values using %global, | You can set your own macro values using %global, | ||
but be sure to define them before you use them. | but be sure to define them before you use them. | ||
Line 805: | Line 862: | ||
Also see Packaging/ | Also see Packaging/ | ||
</ | </ | ||
+ | |||
+ | ==== Custom Built RPM ==== | ||
+ | |||
+ | [[http:// |
rpm.1334257475.txt.gz · Last modified: 2020/08/10 02:29 (external edit)