Package Management
  1. What is package management?
    1. A running program is more than just an executable file. It may be several executables, and any number of configuration and support files. This collection is called a package.
    2. An installed OS is a huge collection of packages.
    3. When not installed, package contents are stored in package files. They contain collections of files, something like like ZIPs.
    4. Packages depend on each other. For instance, the network manager package cannot operate unless a DHCP client is installed.
    5. A package manager
      1. Installs and removes packages.
      2. Determines what additional packages are needed to install a new one.
      3. Determines when its safe to remove a package, since remaining ones might depend on it.
    6. Package managers are usually collections of programs.
    7. Generally, operate on two levels
      1. Low-level: Deals only with the local file system, including package files.
        1. Debian: dpkg
        2. Red Hat: rpm
      2. High-level: Deals with repositories, which are collections of packages files available to install, online or on a disk.
        1. Debian: apt-get, aptitude
        2. Red Hat: yum
  2. Linux distributions use various package management systems; there are several. Two most widely-used seem to be Debian and Red Hat based.
    1. Debian.
      1. Originated with the Debian distribution.
      2. Used by Debian, Ubuntu, Mint.
      3. Package files use .deb extension.
    2. Red Hat.
      1. Originated with Red Hat, a commercial company.
      2. Used by Fedora, CentOS, RHEL, openSUSE.
      3. Package files use .rpm extension. RPM = Red-Hat Package Manager.
  3. Things to do.
    1. Search the repository
      1. Debian: apt-cache search search_string
      2. Red Hat: yum search search_string
    2. Install from a repository.
      1. Debian: apt-get install package_name
      2. Red Hat: yum install package_name
    3. Install a package file.
      1. Debian: dpkg --install package_file
      2. Red Hat: rpm -i package_file
        yum localinstall package_file
    4. Remove a package.
      1. Debian: apt-get remove package_name
      2. Red Hat: yum erase package_name
    5. Update the system from the repository.
      1. Debian: apt-get upgrade
      2. Red Hat: yum update
    6. Upgrade a package from a file.
      1. Debian: dpkg --install package_file
      2. Red Hat: rpm -U package_file
    7. List all packages.
      1. Debian: dpkg --list
      2. Red Hat: rpm -qa
    8. Check if a package is installed.
      1. Debian: dpkg --status package_name
      2. Red Hat: rpm -q package_name
    9. Display information about a package.
      1. Debian: apt-cache show package_name
      2. Red Hat: yum info package_name
    10. Find which package an installed file belongs to.
      1. Debian: dpkg --search file_name
      2. Red Hat: rpm -qf file_name