Show Menu

RPM Build Basics Cheat Sheet by

How to build software and create packages with RPM

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


Scans directory for source files to be used to build software
Helps to manage C header files
creates macros that help the other autotools
Writes the "./c­onf­igu­re" script
Sets up the build enviro­nment for applic­ation libraries
Reads rules to create an all-pu­rpose Makefile
A shortcut that sequen­tially runs the approp­riate all previous autotools tools
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

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


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          OSC - Open Build Service Command Line Client Cheat Sheet
          RPM Cheat Sheet