Table of Content
Weight: 3
Description: Candidates should be able to perform package management using the Debian package tools.
Key Knowledge Areas:
- Install, upgrade and uninstall Debian binary packages
- Find packages containing specific files or libraries which may or may not be installed
- Obtain package information like version, content, dependencies, package integrity and installation status (whether or not the package is installed)
Terms and Utilities:
/etc/apt/sources.list dpkg dpkg-reconfigure apt-get apt-cache aptitude
sources.list
pkg source /etc/apt/sources.list
dpkg
check pkg name dpkg -l |grep grub dpkg --get-selections |grep grub find files in pkg dpkg -L grub-common |grep "bin/" dpkg -s lsof # pkg status dpkg -S lsof # find pkg owning files same as dpkg -L lsof dpkg -i pkg # install dpkg -r pkg # remove pkg dpkg -P pkg # remove pkg with all config dpkg --info grub_0.97-29ubuntu66_amd64.deb dpkg --contents grub_0.97-29ubuntu66_amd64.deb dpkg --unpack package.deb # install the package, but don’t configure it. The package can be configured later with dpkg-reconfigure dpkg --configure package # configure an installed package
apt-get
apt-get update apt-get dist-upgrade apt-get install pkg apt-get install -s pkg # dry-run without install apt-get remove pkg apt-get remove -s pkg # dry-run to remove apt-get clean # remove downloaded pkg apt-get autoremove -s lsof apt-get remove lsof # only remove pkg apt-get autoremove # clean unneeded pkgs apt-get purge pkg # remove pkg and related config, not dependency apt-get -d pkg.deb # download pkg only apt-get source lsof # download source of pkg to current folder find location of downloaded source files updatedb locate lsof_4 download pkg only sudo apt-get install -d grub locate 0.97-29ubuntu66 sudo updatedb locate 0.97-29ubuntu66 /var/cache/apt/archives/grub_0.97-29ubuntu66_amd64.deb
apt-cache
apt-cache showpkg lsof apt-cache showsrc lsof # list source file details apt-cache search "str" # search pkg including str apt-cache stats lsof apt-cache unmet apt-cache depends lsof apt-cache pkgnames sa # list all pkg name starting as sa
aptitude
menu driven system aptitude update # same as apt-get update, update pkg list from APT repos aptitude install pkg aptitude install pkg- # remove pkg aptitude remove pkg sudo dpkg-reconfigure lsof sudo debconf-show pkg
package config
dpkg /etc/dpkg/dpkg.cfg ~/.dpkg.cfg /var/log/dpkg.log apt /etc/apt/sources.list /etc/apt/apt.conf # control APT and dselect options /var/lib/dpkg # installed pkg database
alien
alien --to-rpm xxx.deb alien --install bin-tarball.tar.gz
Quiz questions
1. What makes Debian package management unique? 2. How do you use dpkg to do the following functions: • install a package • obtain package information for an installed package • obtain package information for a package file • remove a package • find out which package owns a given file • find out whether a package is installed 3. How do you use apt-cache to: • find a package that is not installed? • find the full description of a package based on its contents? 4. How do you use apt-get to • install a package? • install a package together with its dependencies?
Answers to quiz questions
1. It is possible to install a package together with its dependencies. 2. dpkg ... • dpkg -i package.deb (install) • dpkg --get-selections |grep pkg • dpkg -I package.deb (information) • dpkg -r package (remove) • dpkg -S $(pwd)/filename (search) • dpkg -s package (status) 3. apt-cache search string apt-cache show package 4. apt-get install package apt-get install package ?