How To Update and Upgrade Ubuntu, Debian, Mint and Kali?


Ubuntu, Debian, Kali and Mint uses the same package management software named dpkg and apt. Updating OS is important part of the system administration. We will look how to update and upgrade deb based distributions.

Update Package Index

First step to update packages for Ubuntu, Debian, Kali and Mint is updating package index. Package index holds most recent available packages from the repository and crosscheck with all ready installed packages. Than upgrade-able packages are created. We need root privileges to run this command. So we use sudo

 $ sudo apt update
Update Package Index
Update Package Index

List Upgradeable Packages

We can list currently upgrade-able packages. We will use apt list command with --upgradeable option.

$ sudo apt list --upgradeable

Upgrade All Packages

Now we have required information to upgrade packages. We also know which packages will be upgraded by listing upgrade-able packages. We will upgrade with apt dist-upgrade which will upgrade and made version selection automatically. We required root privileges which is given by sudo.

$ sudo apt dist-upgrade -y

Upgrade Specific Package

In previous example we will upgraded all newly versioned packages. But in some cases like comp ability this make break comp-ability of existing software. We may need to upgrade specific packages. We will upgrade specific package by giving the package name to the dist-upgrade command as parameter. In this example we will upgrade package named tmux.

$ sudo apt dist-upgrade tmux

Update and Upgrade In Single Shot

In daily operations we may need fast and furious solution whic will update and upgrade packages. I generally bind two command together to make things faster and still reliable. If update operation fails upgrade will not start with the following command.

$ sudo apt update && sudo apt dist-upgrade -y
Update and Upgrade In Single Shot
Update and Upgrade In Single Shot

Clean Package Cache

Over time the downloaded packages and package metada will be hold in cache. This will take some space from our disk. We need to clean this cache periodically to get our disk space. We can clean our apt and dpkg cache with autoclean option.

$ sudo apt autoclean

Remove Unneeded Packages

Over time some packages are obsolete or not needed by their parents. These package are not update nor removed automatically. We can remove these unneeded packages with autoremove option like below.

$ sudo apt autoremove -y

LEARN MORE  How To Install and Upgrade RPM Packages In CentOS, RHEL, Fedora, Mandriva

Leave a Comment