The legendary, mature widely used stable Linux distribution with the best most reliable tenure.
- Key Points
- Package Management
- Docker
- Debian Preseeding - Automated Installations
- Debian Change Log tool
- Meme
Philosophical thoroughbred open-source has stood the test of time. It's the open source purist's choice.
Debian has won the Linux distro wars along with its derivative Ubuntu due to Redhat killing its original open source Redhat and later community effort derivative CentOS in order to try to force people to pay for Redhat Enterprise Linux. In reality, all this has done is cause Redhat to become a legacy Linux distribution.
If you could save only one Linux distribution to remain in existence, or bet the future on, it would be Debian.
Debian packages are deb format files.
dpkg installs / uninstalls a single deb package.
It tracks the installed packages in the /var/lib/dpkg/ directory and can query the list of installed packages
or specific details on a single installed package.
apt* programs search and download deb packages from online repositories (or local media) and get dkg to install them.
-
apt-get- the original package management programapt-cachesearches the package lists downloaded byapt-get
-
apt- newer wrapper command toapt-getwith a subset of the functionality but different output format -
aptitude- newest with different output again but unlikeapt-getandaptneeds to be installed. Not sure why anybody cares to use this longer command, it's not like we get paid by the keystroke...
All three work in a similar way, so where you see apt-get you can substitute for apt or aptitude if you want to see a different output format.
If in doubt, just stick to apt-get and apt-cache for everything for simplicity.
Any one of these commands:
apt-get updateapt updateaptitude updateQuiet:
apt-get update -qqAny one of these commands:
apt-cache search "$term"apt gives a fancier colourised multi-line output for each package found, but I prefer the simpler concise single line format of apt-get which is easier to grep:
apt search "$term"aptitude uses a different but single line format:
aptitude search "$term"apt-get install "$package"apt install "$package"aptitude install "$package"Auto-accept installing without confirmation prompt:
apt-get install -y "$package"Add -q or -qq for quiet modes:
apt-get install -q "$package"Quiet and doesn't prompt:
apt-get install -qq "$package"Show version that would be installed:
apt list "$package"Show details on a package without it having to be installed first like with dpkg:
apt show "$package"apt-cache showpkg "$package"aptitude show "$package"Show version, repo and debian pinning priority:
apt-cache policy "$package"Show version and repo in one line concise format without repo pinning priority:
apt-cache madison "$package"apt-get upgrade "$package"apt upgrade "$package"apt list --upgradableapt list --upgradable "$package"This will print almost nothing if the package is already up to date, just this:
Listing... Done
But if the package is upgradeable, will output something like this:
apt list --upgradable tzdataListing... Done
tzdata/oldstable 2025b-0+deb12u2 all [upgradable from: 2025b-0+deb11u2]
N: There are 2 additional versions. Please use the '-a' switch to see them.
With a zero exit code either way.
apt install --only-upgrade "$package"apt-file is an optional program, so you have to install it first:
apt-get install -y apt-fileThen download the package list information it needs to search package contents and not just name / version / description:
apt-file updateNow use it to search for which package would provide file mysql_config:
apt-file search mysql_configList a package's contents without having to install it first:
apt-file list "$package"List installed packages:
dpkg -lList contents of installed package:
dpkg -L "$package"Which installed package owns /usr/bin/mysql_config:
dpkg -S /usr/bin/mysql_configWhat depends on a package:
apt-cache rdepends --installed "$package"Print package info:
dpkg -p "$package"dpkg -s "$package"Check for broken package(s)
dpkg -C ["$package"]debconf-get-selections --installerrepreproDebian is an excellent choice for a base docker image from which to derive and is used by many docker images in the world, including several of my own at HariSekhon/Dockerfiles.
While not as lean as Alpine, it is full-featured and more compatible.
docker run -it --rm debian:11 bashSwitch to a newer repo:
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
apt updateNow see which packages can be upgraded:
apt list --upgradableListing...
adduser/oldstable 3.134 all [upgradable from: 3.118+deb11u1]
apt/oldstable 2.6.1 amd64 [upgradable from: 2.2.4]
base-files/oldstable 12.4+deb12u13 amd64 [upgradable from: 11.1+deb11u11]
base-passwd/oldstable 3.6.1 amd64 [upgradable from: 3.5.51]
bash/oldstable 5.2.15-2+b10 amd64 [upgradable from: 5.1-2+deb11u1]
bsdutils/oldstable 1:2.38.1-5+deb12u3 amd64 [upgradable from: 1:2.36.1-8+deb11u2]
coreutils/oldstable 9.1-1 amd64 [upgradable from: 8.32-4+b1]
dash/oldstable 0.5.12-2 amd64 [upgradable from: 0.5.11+git20200708+dd9ef66-5]
debconf/oldstable 1.5.82 all [upgradable from: 1.5.77]
debian-archive-keyring/oldstable 2023.3+deb12u2 all [upgradable from: 2021.1.1+deb11u1]
debianutils/oldstable 5.7-0.5~deb12u1 amd64 [upgradable from: 4.11.2]
diffutils/oldstable 1:3.8-4 amd64 [upgradable from: 1:3.7-5]
dpkg/oldstable 1.21.22 amd64 [upgradable from: 1.20.13]
e2fsprogs/oldstable 1.47.0-2+b2 amd64 [upgradable from: 1.46.2-2+deb11u1]
findutils/oldstable 4.9.0-4 amd64 [upgradable from: 4.8.0-1]
gpgv/oldstable 2.2.40-1.1+deb12u2 amd64 [upgradable from: 2.2.27-2+deb11u2]
grep/oldstable 3.8-5 amd64 [upgradable from: 3.6-1+deb11u1]
gzip/oldstable 1.12-1 amd64 [upgradable from: 1.10-4+deb11u1]
hostname/oldstable 3.23+nmu1 amd64 [upgradable from: 3.23]
...
Now test whatever upgrades you want using the usual upgrade commands given above under Upgrade.
Debian can be installed using Preseeding for fully automated hands-off installations:
https://wiki.debian.org/DebianInstaller/Preseed
Boot command to start installer with a preseed.cfg text config file which can be bundled into an installation medium
such as a DVD iso or served by a web server on the local network.
This is called by adding the following kernel arguments in the installation grub bootloader:
auto=true url=http://192.168.1.2:8080/preseed.cfg hostname=debian domain=localIf you just want to start a quick webserver from your local directory, you can do this which starts a local webserver on port 8080:
warning this will share out your entire $PWD local directory contents without authentication so copy to an empty
/tmp directory and share that so nothing else is exposed:
mkdir -p -v /tmp/serve-preseed &&
cp -v preseed.cfg /tmp/serve-preseed/ &&
cd /tmp/serve-preseed &&
python -m SimpleHTTPServerHariSekhon/Templates - preseed.cfg
Packer builds fully automated Virtual Machine golden templates from which to clone virtual machines by booting the Debian installer medium with Debian Preseed template.
Real-world Preseed config used by Packer build:
HariSekhon/Packer-templates - installers/preseed.cfg
HariSekhon/Packer-templates - debian-x86_64.vbox.pkr.hcl
debchangedch--increment adds a new entry and drops you in to editor, with a username + timestamp footer eg:
dch -i -c hadoop.logPorted from private Knowledge Base page 2010+ - not sure why so late given usage from 2002 - young guys don't know the value of documentation
