Getting Started with Software on Your Raspberry Pi: An Introduction to apt
Aaron Rose
Software Engineer & Technology Writer
Introduction
Welcome to the exciting world of Raspberry Pi! One of the first things you’ll want to do is start installing software to make your little computer do amazing things. In the Raspberry Pi OS, the primary tool you'll use for managing software is called the Advanced Package Tool, or apt for short. Don’t let the name intimidate you; apt
is actually a very user-friendly and powerful way to install, update, and remove programs. This guide is designed for beginners, so we'll walk through the essential apt
commands you need to know to get started. Think of apt
as your personal software assistant, always ready to help you find and manage the tools you need for your Raspberry Pi projects.
The Command Line: Your Gateway to apt
You’ll be interacting with apt
through the terminal, which is a text-based interface for your Raspberry Pi. You can open the terminal by clicking on its icon (usually a black square with >_
inside) in the top left of your screen or by finding it in the main menu under "Accessories." Once the terminal window is open, you're ready to start using apt
.
Remember, most apt
commands require administrator privileges to make changes to your system. This is why you'll often see the command sudo
(Super User Do) before apt
. It's like saying "Hey system, I have permission to do this!"
Essential apt Commands for Beginners
Let's dive into the fundamental apt
commands you'll use most frequently:
1. Updating Your Package Lists
Before you install anything new, it’s crucial to update your Raspberry Pi’s list of available software. This ensures you’re seeing the latest versions. Use the following command:
sudo apt update
Expected Output (abbreviated):
Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
...
Fetched 5,123 kB in 3s (1,708 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
This command goes out to the software repositories online and downloads the latest information about the available packages.
2. Upgrading Your Installed Software
Once you've updated the package lists, you can upgrade the software that's already installed on your Raspberry Pi to their newest versions. This is important for security and getting the latest features.
sudo apt upgrade
Expected Output (abbreviated):
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libglib2.0-0 libglib2.0-bin libglib2.0-data
...
Do you want to continue? [Y/n]
You'll usually be prompted to confirm the upgrade. Type Y
and press Enter to proceed.
3. Installing New Software
To install a new program, you need to know its package name. For example, let's install the neofetch
tool, which displays system information in the terminal:
sudo apt install neofetch
Expected Output (abbreviated):
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following new packages will be installed:
neofetch
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 52.2 kB of archives.
After this operation, 141 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Again, you'll likely be asked to confirm. Type Y
and press Enter. Once installed, you can run neofetch
in the terminal to see it in action.
4. Searching for Software
If you don’t know the exact package name, you can search for software related to what you want to do. For example, to find media players:
sudo apt search media player
Expected Output (abbreviated):
Sorting... Done
Full Text Search...
chromium-browser/stable 92.0.4515.98-rpt1+deb11u1 armhf
The open-source browser behind Google Chrome
kodi/stable 19.1-4~rpt2+deb11u1 armhf
Open Source Home Theatre/Media Center
...
This will give you a list of packages whose name or description matches your search terms.
Removing and Cleaning Up Software
Over time, you might want to remove software you no longer use. apt
offers a couple of ways to do this:
1. Removing a Package
The remove
command uninstalls the specified package but might leave behind some configuration files.
sudo apt remove neofetch
Expected Output (abbreviated):
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
neofetch
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 141 kB disk space will be freed.
Do you want to continue? [Y/n]
2. Purging a Package
The purge
command is more thorough; it removes the package and its configuration files. Use this if you’re sure you won’t need the software or its settings again.
sudo apt purge neofetch
Note: If you've already used remove
, you might not see much output from purge
unless there are configuration files left.
3. Automatically Removing Unneeded Dependencies
Sometimes, installing a package also installs other packages it needs (dependencies). When you uninstall the original package, these dependencies might not be needed anymore. The autoremove
command cleans these up:
sudo apt autoremove
Expected Output (abbreviated - might not show anything if no unused dependencies):
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libsomething-unused1 libsomething-unused2
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 4,096 kB disk space will be freed.
Do you want to continue? [Y/n]
It's a good practice to run sudo apt autoremove
after removing packages to keep your system tidy.
Conclusion: Your Journey with apt Has Just Begun!
Understanding the basics of apt
is a fundamental step in using your Raspberry Pi effectively. With these core commands – update
, upgrade
, install
, search
, remove
, purge
, and autoremove
– you can confidently manage the software on your device. As you explore further, you’ll discover even more advanced features of apt
, but for now, these commands will serve you well in installing new tools, keeping your system up-to-date, and removing software you no longer need. Happy tinkering with your Raspberry Pi!
Aaron Rose is a software engineer and technology writer at tech-reader.blog.
Comments
Post a Comment