Installing and Reinstalling Packages

Installing and Reinstalling Packages

apt-get and dpkg


Installing, Uninstalling, and Updating

  • Update package list: sudo apt-get update
  • Upgrade packages: sudo apt-get upgrade
  • Clean package list caches: sudo apt-get autoclean
  • Install package: sudo apt-get install XXX or dpkg - i XXX
  • Install and fix dependencies: sudo apt-get -f install XXX
  • Remove/delete package: sudo apt-get remove XXX or dpkg -r XXX
  • Remove package and dependencies: sudo apt-get autoremove
  • Remove package and delete all configurations: sudo apt-get remove XXX --purge or dpkg -P XXX
  • Reinstall package: sudo apt-get install XXX --reinstall

Adding Package Keys

sudo apt-key adv --keyserver hkp://KEYSERVER_URL --recv KEY_ID

Removing Package Keys

  1. List all the packages: sudo apt-key list
  2. Identify the desired package key to delete, in format such as: pub 1024R/B455BEF0 2010-07-29 uid Launchpad clicompanion-nightlies
  3. Delete the key:  sudo apt-key del KEYID
  4. Recheck package list: sudo apt-key list

Add / Remove Packages to apt-get

echo "deb http://REPOSITORY/apt/ubuntu VERSION/PACKAGE" | sudo tee /etc/apt/sources.list.d/PACKAGE_LIST
sudo rm /etc/apt/sources.list.d/PACKAGE_LIST

 

Read more: 1, 2, 3

 

 

25261570786_e974bd778b_b_apt-get