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 18:54] – [RPM Spec File Information] 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 421: | Line 471: | ||
| Do not create a " | Do not create a " | ||
| </ | </ | ||
| + | |||
| + | ==== SPEC file sections explained ==== | ||
| <code text> | <code text> | ||
| Line 507: | Line 559: | ||
| here you configure and compile/ | here you configure and compile/ | ||
| - | Many programs follow the GNU configure approach (or some variation). By default, they will install to a prefix of "/ | + | Many programs follow the GNU configure approach (or some variation). | 
| + | By default, they will install to a prefix of "/ | ||
| + | However, since you are packaging it, change the prefix to "/ | ||
| + | Libraries should be installed to either /usr/lib or /usr/lib64 depending on the architecture. | ||
| - | Since GNU configure is so common, the macro " | + | Since GNU configure is so common, the macro " | 
| + | invoke the correct options (e.g. change the prefix to /usr). Some variation of this often works: | ||
|  |  | ||
| Line 516: | Line 572: | ||
| make %{? | make %{? | ||
| - | More more information, | + | More more information, | 
| + | and | ||
| + | "Open Source Development Tools: An Introduction to Make, Configure, Automake, Autoconf" | ||
| Some programs use cmake. See Packaging/ | Some programs use cmake. See Packaging/ | ||
| Line 762: | Line 820: | ||
| Macros | Macros | ||
| Macros are text in the format %{string}. Typical macros: | Macros are text in the format %{string}. Typical macros: | ||
| + | </ | ||
| - | Macro Typical Expansion Meaning | + | |
| - | %{_bindir}	/ | + | ^ Macro	^ Typical Expansion | 
| - | %{_builddir}	~/ | + | | %{_bindir} | 
| - | a subdirectory of the build directory. See %buildsubdir. | + | | %{_builddir} | 
| - | %{buildroot}	~/ | + | | %{buildroot} | 
| - | which copies files from a subdirectory of %{_builddir} | + | | %{buildsubdir} | 
| - | to a subdirectory of %{buildroot}. | + | | %{_datadir} | 
| - | (Historically, | + | | %{_defaultdocdir} | 
| - | %{buildsubdir}	%{_builddir}/ | + | | %{dist} | 
| - | files are compiled during the %build stage. It is set after %setup. | + | | %{fedora} | 
| - | %{_datadir}	/ | + | | %{_includedir} | 
| - | %{_defaultdocdir}	/ | + | | %{_infodir} | 
| - | %{dist}	.fcNUMBER	 Distribution+version short name (e.g. " | + | | %{_initrddir} | 
| - | %{fedora}	NUMBER	 Number of fedora release (e.g. " | + | | %{_libdir} | 
| - | %{_includedir}	/ | + | | %{_libexecdir} | 
| - | %{_infodir}	/ | + | | %{_localstatedir} | 
| - | %{_initrddir}	/ | + | | %{_mandir} | 
| - | %{_libdir}	/ | + | | %{name} | 
| - | %{_libexecdir}	/ | + | | %{_sbindir} | 
| - | %{_localstatedir}	/ | + | | %{_sharedstatedir} | 
| - | %{_mandir}	/ | + | | %{_sysconfdir} | 
| - | %{name} Name of package, set by Name: tag | + | | %{version} | 
| - | %{_sbindir}	/ | + | |
| - | %{_sharedstatedir}	/ | + | |
| - | %{_sysconfdir}	/ | + | |
| - | %{version} Version of package, set by Version: tag | + | |
| - | Learn more about macros by looking in /etc/rpm/* and / | + | <code text> | 
| - | especially / | + | Learn more about macros by looking in /etc/rpm/* and / | 
| - | show values that RPM will use for macros (altered by rpmrc and macro configuration files). | + | 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, | ||
| Line 803: | Line 862: | ||
| Also see Packaging/ | Also see Packaging/ | ||
| </ | </ | ||
| + | |||
| + | ==== Custom Built RPM ==== | ||
| + | |||
| + | [[http:// | ||
rpm.1334256895.txt.gz · Last modified: 2020/08/10 02:29 (external edit)
                
                