os:linux:distributions:debian:packagemanagement
Table of Contents
OS - Linux - Debian - Package Management
Notes
Get a list of installed packages
dpkg --get-selections
Source: How-To Geek - Show the List of Installed Packages on Ubuntu or Debian
Set apt-get to use 1 specific mirror
Tested on stretch.
To change the apt-get sources.list to only use the ftp.nluug.nl mirror:
#deb http://ftp.nl.debian.org/debian stretch main contrib deb https://ftp.nluug.nl/debian stretch main contrib # security updates #deb http://security.debian.org stretch/updates main contrib deb https://ftp.nluug.nl/debian stretch-updates main contrib
Clean the apt cache
Cleans out the apt cache in /var/cache/apt/archives/.
apt-get clean
Source:Ask Ubuntu - Is it possible to clean the APT cache from the command line?
Delete packages from previous releases
For deleting packages that were leftover from previous releases. In this example from debian 7 and 8 on a debian 9 system.
Test removal:
apt-get remove --dry-run `dpkg -l | egrep "deb8|deb7" | awk '{print $2 " "}' | tr -d "\n"`
Actually remove:
apt-get remove `dpkg -l | egrep "deb8|deb7" | awk '{print $2 " "}' | tr -d "\n"`
Force IPv4 usage
For when apt for some reason thinks it can start using IPv6 in an environment with only IPv4 connectivity.
echo "Acquire::ForceIPv4 \"True\";" > /etc/apt/apt.conf.d/ForceIPv4
os/linux/distributions/debian/packagemanagement.txt · Last modified: 2024/03/04 01:55 by bas