Page cover image

How Package Managers Work on Raspberry Pi

When using a Debian-based distribution like Raspberry Pi OS, the primary package manager is APT (Advanced Package Tool).

This tutorial will guide you through the basics of using APT to install and uninstall packages.

Installing Packages

To install a package, you use the apt install command. Here's a step-by-step guide on what happens when you install a package:

sudo apt install tree

Repository Communication

APT checks your system's /etc/apt/sources.list and /etc/apt/sources.list.d directory to know where to fetch packages from.

Communicating with software repositories...

Dependency Resolution

APT determines if tree requires any additional packages (dependencies) to function and prepares to install them if needed.

Resolving dependencies...

Disk Space Calculation

Before proceeding, APT calculates the required disk space and informs you about it.

This package will use X MB of disk space.

User Confirmation

APT asks for your confirmation to continue unless you use the -y flag to bypass this prompt.

Do you want to continue? [Y/n]

Download and Installation: APT downloads the package and any dependencies, then installs them.

Downloading and installing packages...

Access to the Package: Once installed, you can start using tree.

tree

Uninstalling Packages

To remove a package, use apt remove or apt purge.

Using apt remove:

This command will uninstall the package but leave its configuration files.

sudo apt remove tree

You'll be prompted to confirm the removal unless you use -y:

Do you want to continue? [Y/n]

Using apt purge:

To remove the package along with its configuration files:

sudo apt purge tree

Additional Notes

  • Updating Package Lists: Always update your package lists before installing new software.

sudo apt update
  • Upgrading Packages: To upgrade all your installed packages to their latest versions:

sudo apt upgrade
  • Cleaning Up: After installations and removals, clean up the downloaded package files.

esudo apt clean

And remove any unnecessary packages:

sudo apt autoremove

By understanding and using these APT commands, you can effectively manage the software on your Raspberry Pi, ensuring it's up-to-date and configured to your preferences.

Last updated

Was this helpful?