Simulate Packages Installation using APT

Simulate Packages Installation using APT

When installing packages with APT on Debian-based Linux distributions (e.g. Ubuntu), it's often useful to preview what will happen before making actual changes to the system. This is especially handy for verifying dependencies, checking disk space, or avoiding unintended package installations. This tutorial shows how to simulate packages installation using APT.

APT provides the --dry-run option (equivalent to --simulate) to simulate an installation without actually modifying the system. The option goes through the installation process without actually downloading or installing any packages. For example:

sudo apt install --dry-run -y tmux
sudo apt install --simulate -y tmux

When you run either command, APT will output a detailed list of actions it would take, including any additional packages that would be installed. This allows you to catch potential issues or surprises before committing to the actual installation.

Here's a sample output you might see:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libevent-core-2.1-7t64 libutempter0
The following NEW packages will be installed:
  libevent-core-2.1-7t64 libutempter0 tmux
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Inst libevent-core-2.1-7t64 (2.1.12-stable-9ubuntu2 Ubuntu:24.04/noble [amd64])
Inst libutempter0 (1.2.1-3build1 Ubuntu:24.04/noble [amd64])
Inst tmux (3.4-1ubuntu0.1 Ubuntu:24.04/noble-updates [amd64])
Conf libevent-core-2.1-7t64 (2.1.12-stable-9ubuntu2 Ubuntu:24.04/noble [amd64])
Conf libutempter0 (1.2.1-3build1 Ubuntu:24.04/noble [amd64])
Conf tmux (3.4-1ubuntu0.1 Ubuntu:24.04/noble-updates [amd64])

The output shows what APT would do during a real installation. It lists the main package (tmux) and any additional dependencies it would install (libevent-core-2.1-7t64, libutempter0). Lines starting with Inst show which packages would be installed, and Conf indicates they would be configured afterward. No changes are made - this is just a safe preview.

Leave a Comment

Cancel reply

Your email address will not be published.