A quick guide to software packaging
Table of Contents
1 Building software from source
1.1 The earliest days
- compile and link a few files into an executable, copy it somewhere
- maybe write a configuration file, copy it somewhere
1.2 make
- automate the build process for more complex software
- automate installation ("make install")
- probably doesn't automate removal ("make uninstall" is rare)
1.3 autoconfiguration
- GNU configure and autoconf
- automatically tailors software to build environment for better multiplatform support
- improves portability, but complicates installation even more
2 Package management
2.1 Tracking files in a package
- most package systems are based on an existing file archive format (tar, cpio, zip)
- package installation often means just extracting files from the archive
- many package managers also update a central database of installed files
- removing packages mainly means removing the files associated with a given package
2.2 handling configuration and dynamically-generated files
- some software needs some customization beyond installation of program, data, and configuration files
- a package can contain pre-install and post-install scripts that perform customization and dynamic file generation at installation time
- also pre-removal and post-removal scripts to remove dynamically-generated files associated with the package
2.3 dependency management
- one package may require that other packages be installed
- a package may require specific versions of libraries or other software
- some packages may conflict with each other (they can't both be installed on the same system)
- basic package management can at least warn of requirements
- more sophisticated package management can handle automatic installation of dependencies, removal of automatically-installed dependencies that are no longer needed
2.4 package repositories
- central collection of packages maintained for a given operating system version
3 Package managers
3.1 Debian dpkg (.deb), Red Hat RPM (.rpm)
- lowest-level package installation/removal tool
- dpkg packages named *.deb, used primarily with Debian, and derived distributions
- RPM packages named *.rpm, used primarily with Red Hat and derived distributions
- work with individual package files
- can install, remove, configure, and provide information about packages
3.2 APT (Advanced Package Tool), YUM
- APT primarily associated with .deb packages, although versions exist for .rpm as well
- YUM primarily associated with .rpm packages
- works with package names (handles automated download of packages from repositories)
- does higher-level dependency analysis, to automatically install dependent packages or remove unneeded packages
3.3 Aptitude, Synaptic, etc.
- provide even higher-level user interface to APT
3.4 APT in detail
- apt-get update – contact configured repositories (/etc/apt/sources.list) and download latest package indexes
- apt-get upgrade – compare installed versions with repository versions, offer to upgrade to newer versions in repository
- apt-get install – install a named package (and its dependents)
- apt-get remove – remove a package (but leave behind config files)
- apt-get purge – remove a package and its configuration files
3.5 YUM in detail
- yum check-update – contact configured repositories (/etc/yum.conf), download latest package indexes, show upgradeable packages
- yum update – upgrade to newer versions in repository
- yum install – install a package (and its dependents)
- yum erase – remove a package