1. MagicESP
  2. Ubuntu Server 22.04
  3. Ubuntu Server Package Management

Ubuntu Server Package Management

package update and upgrade

upgrade (no reboot required)

sudo apt update && sudo apt -y upgrade

dist-upgrade and autoremove (reboot required)

sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt -y dist-upgrade && sudo apt -y autoremove && sudo reboot
sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" dist-upgrade && sudo apt -y autoremove && sudo reboot
  • https://www.cyberciti.biz/faq/explain-debian_frontend-apt-get-variable-for-ubuntu-debian/
  • https://serverfault.com/questions/227190/how-do-i-ask-apt-get-to-skip-any-interactive-post-install-configuration-steps

automatically download and install important updates (interactively)

sudo dpkg-reconfigure unattended-upgrades

Debian Major Version Upgrade

cat /etc/debian_version

system upgrade without prompts

sudo apt install -y update-manager-core && sudo do-release-upgrade -f DistUpgradeViewNonInteractive

search and install package

search package

apt search {{ packagename.value }}
apt search {{ packagename.value }} | less
apt search {{ packagename.value }} | grep {{ packagename.value }} | less
apt list {{ packagename.value }}

install package

sudo apt install {{ packagename.value }}
sudo apt install -y {{ packagename.value }}

reinstall half-installed package

sudo apt install --reinstall {{ packagename.value }}

which package do i installed

dpkg -l
dpkg -l | grep {{ packagename.value }}
dpkg -l | grep {{ packagename.value }} | less

remove package

sudo apt remove {{ packagename.value }}
sudo apt remove -y {{ packagename.value }}

purge package (also remove the config files)

sudo apt purge {{ packagename.value }}
sudo apt purge -y {{ packagename.value }}