RPM Build Basics Cheat Sheet

A cheat sheet in English by Craig Gardner

How to build software and create packages with RPM

19,892 views 3,898 downloads 29 Oct 2015 History
4.3 avg · 1 rating

tar archives

tar xzf { source­-co­de-­arc­hiv­e.tgz }
extract a gzip-c­omp­ressed file
tar xjf { source­-co­de-­arc­hiv­e.t­ar.bz2 }
extract a bz2-co­mpr­essed file
tar cjf { compressed-archive.tar.bz2 } { directory-to-archive }
create a tar archive from the contents of a directory

autotools

autoscan
Scans directory for source files to be used to build software
autoheader
Helps to manage C header files
aclocal
creates macros that help the other autotools
autoconf
Writes the "./c­onf­igu­re" script
libtool
Sets up the build enviro­nment for applic­ation libraries
automake
Reads rules to create an all-pu­rpose Makefile
autoreconf
A shortcut that sequen­tially runs the approp­riate all previous autotools tools
./conf­igure
setup the build scripts according the discovered enviro­nment
./configure --libdir=/usr/lib
set some important variables from the comman­dline without manually editing config files

Manual Build

make
compile and link according to rules in Makefile
make install
put the built binaries and other software files into their runtime location

RPM database queries

rpm -qa
Show all packages installed on the system
rpm -qi { packag­ename }
Show high-level inform­ation about an installed package
rpm -qf { filename }
Show which package owns filename
rpm -ql { packag­ename }
List the files controlled by a package
rpm -qlv { packag­ename }
Verbose listing of files
rpm -qlvc { packag­ename }
Verbose listing of only the config­uration files
rpm -qlvd { packag­ename }
Verbose listing of only the docume­ntation files
rpm -qV { packag­ename }
Verify the permis­sions of the controlled files
rpm -qVv { packag­ename }
Verify, verbosely

RPM instal­lation commands

rpm -i { filena­me.rpm }
Install the filename RPM package
rpm -Uvh { filena­me.rpm }
Update (will also install) the RPM package, verbosely, showing progess
rpm -Fvh { filena­me.rpm }
Freshen the RPM package, i.e.: update the installed software if the file contains a newer versio­n/r­elease of the package
Update a package using a URL
rpm -U --test { filena­me.rpm }
Test run of instal­lation without actually installing anything
rpm -e { packag­ename }
Remove a package from the system
rpm -e --test { packag­ename }
Test the removal of a package without actually removing it

RPM build

rpmbuild -bb { packag­ena­me.spec }
Build the standard package RPM file using the inform­ation contained in the specfile
rpmbuild -bs { packag­ena­me.spec }
Build only the source RPM
rpmbuild -ba { packag­ena­me.spec }
Build both the binary and source RPM

Badges

Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 2

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.