Skip to content

Latest commit

 

History

History
138 lines (83 loc) · 2.98 KB

File metadata and controls

138 lines (83 loc) · 2.98 KB

Manage Software Packages

Tips for working with package-managers like apt-get

Table of Contents

 

A Typical Workflow

  • Refresh the list of available packages
  • List packages to find the one we need
  • List available revisions of a package
  • Install or upgrade a package

 

apt / apt-get (Ubuntu, Debian)

 

Find the Origin of a File

Locate the package that a file belongs to
(see also ask-ubuntu: How do I find the package that provides a file?)

 

dpkg search

  • scans the content of installed packages only

dpkg -S <full/path/and/filename>

or

dpkg --search $(which <command>)

 

apt-file find

  • may need to install/refresh this tool
  • may list packages that are not installed
sudo apt install apt-file
sudo apt-file update
apt-file find  <filename>

 

Install or Upgrade a Package

 

Install/upgrade the latest revision of a package

sudo apt install <package>

 

Install/upgrade a specific revision of a package

sudo apt install <package>=<revision>

 

List Available Revisions of a Package

sudo apt-cache policy <package>

 

List Packages

 

List available packages

apt list

 

List installed packages

apt list --installed

 

List upgradable packages

apt list --upgradable

 

Manage Package-Repository Keys

Add a Missing Key

  • Run this to resolve errors like:
    GPG error: ... The following signatures were invalid: EXPKEYSIG ...
  • Can point to a different key-server, as long it is a server you trust
  • This format should work over firewalls/VPN as well

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys <KEY>

 

Refresh the List of Available Packages

(does not change the configuration of the host -
nothing is installed or upgraded except the packages-DB)

sudo apt update