Last Edited: 8/24/2022
APT stands for Advanced Package Tool and is a standard for developing and pushing packages out. There are three portions to this which is apt, apg-get and apt-cache. apt is a front end to dpkg. This means that apt serves the Debian, Ubuntu, and related Distributions.
The “apt update” commande is used to communicate with repositories to see what is present. This can take the form of packages you have not installed yet, or if there are updates to packages that you have installed. When discussing installing any software packages like NFS, Apache; or whatever, one of the first order of operations is generally to run apt-update to make sure any remaining commands or requests is done with the most up to date information.
Using apt-autoremove on occasion is prudent in order to remove old versions. This is especially helpful for maintaining systems and keeping the /boot directory down to something manageable. Failing to properly maintain the boot partition might (and often does) contribute to problems when installing newer versions of the Kernel packages (due to a lack of space)
CHECKING WHAT NEEDS TO BE UPGRADED.
Apt can be used to provide a list of packages that need to be upgraded.
apt list --upgradable
FINE CONTROLS – Answers for questions you might not have thought to task.
Debian, Ubuntu and derivatives use debian package configuration system system called “debconf”. This system uses apt and dpkg to install “.deb:” files. There are a few environmental variables you might want to know in order to help automate your installments. If you are interactively executing this you can wait and interact with the updates. Sometimes you might be called away and an installation might be between points which might be bad.
The option “q” can be used to quiet operations and forgo a progress bar.
apt upgrade -qy
The APT File configuration is kept in /etc/apt
The following code overwrites “sources.list” with values more befitting an older deployment, say one you want to update but for which modern Ubuntu has passed on. Please do not use this without really being sure – and perhaps even backing the file up first. To be clear I am putting this here because I need to be reminded of it often enough. Plus it reminds me of how to use “cat” with redirections for writing contents to a file.
cat << EOF > /etc/apt/sources.list deb http://old-releases.ubuntu.com/ubuntu/ xenial main restricted deb http://old-releases.ubuntu.com/ubuntu/ xenial-updates main restricted deb http://old-releases.ubuntu.com/ubuntu/ xenial universe deb http://old-releases.ubuntu.com/ubuntu/ xenial-updates universe EOF