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
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-cache
searches the package lists downloaded byapt-get
-
apt
- newer wrapper command toapt-get
with a subset of the functionality but different output format -
aptitude
- newest with different output again but unlikeapt-get
andapt
needs 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 update
apt update
aptitude update
Quiet:
apt-get update -qq
Any 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-file
is an optional program, so you have to install it first:
apt-get install -y apt-file
Then download the package list information it needs to search package contents and not just name / version / description:
apt-file update
Now use it to search for which package would provide file mysql_config
:
apt-file search mysql_config
List a package's contents without having to install it first:
apt-file list "$package"
List installed packages:
dpkg -l
List contents of installed package:
dpkg -L "$package"
Which installed package owns /usr/bin/mysql_config
:
dpkg -S /usr/bin/mysql_config
What 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 --installer
reprepro
Debian 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.
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=local
If 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 SimpleHTTPServer
HariSekhon/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
debchange
dch
--increment
adds a new entry and drops you in to editor, with a username + timestamp footer eg:
dch -i -c hadoop.log
Ported from private Knowledge Base page 2010+ - not sure why so late given usage from 2002 - young guys don't know the value of documentation