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:
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.
Dependency Resolution
APT determines if tree
requires any additional packages (dependencies) to function and prepares to install them if needed.
Disk Space Calculation
Before proceeding, APT calculates the required disk space and informs you about it.
User Confirmation
APT asks for your confirmation to continue unless you use the -y
flag to bypass this prompt.
Download and Installation: APT downloads the package and any dependencies, then installs them.
Access to the Package: Once installed, you can start using 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.
You'll be prompted to confirm the removal unless you use -y
:
Using apt purge
:
To remove the package along with its configuration files:
Additional Notes
Updating Package Lists: Always update your package lists before installing new software.
Upgrading Packages: To upgrade all your installed packages to their latest versions:
Cleaning Up: After installations and removals, clean up the downloaded package files.
And remove any unnecessary packages:
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?