VMware ESXi and vSphere Cluster Management
Using the Raspbian Repository with apt-cache and apt-get
Learn how to search Raspbian package metadata with apt-cache, inspect package details, and install or remove software with apt-get.
A Raspbian repository is a remote collection of software packages, package indexes, and supporting information. It gives your Raspberry Pi access to applications built for the processor architectures supported by your Raspbian system.
The catalog can contain browsers, text editors, games, server software, command-line utilities, libraries, and many other types of software. Raspbian is based on Debian, so it uses APT, the Advanced Packaging Tool, to query package repositories and manage software installed on the system.
This lesson uses two command-line tools: apt-cache for searching and inspecting package metadata, and apt-get for installing and removing packages.
How package management works
A package is a distributable unit of software and related metadata. It normally contains the files needed for an application, library, or utility, together with information APT uses to install and manage it.
- Package name: the exact identifier APT uses, such as
dreamchess. - Package description: a short explanation of what the package provides.
- Dependency: another package required for a package to function. APT can install required dependencies automatically.
- Package metadata: information such as names, versions, architectures, sizes, dependencies, homepages, and descriptions.
- Repository metadata: package information downloaded from configured package sources and stored locally for querying.
- Installed package: a package whose files have been placed on the system by the package manager.
- Package manager: software that finds, installs, updates, and removes packages while handling dependencies.
- Architecture: the processor platform for which a package is built.
A typical workflow is to search package metadata, identify the exact package name, inspect its details, and then install or remove it. Searching and displaying metadata normally do not modify the system. Installation and removal do modify system-wide software and therefore require administrative privileges.
Before using APT
Your Raspberry Pi needs a working network connection to download package files. Raspbian must also have usable, configured package sources. The local package metadata must contain information about the package you want to find.
sudo runs an authorized command with administrator privileges. The administrative account is called root. Because installing and removing software change system files, these operations use sudo. Use elevated privileges only for commands that need them.
Searching with apt-cache
apt-cache queries package metadata available locally on the system. Its search operation looks for a term in package names and descriptions, so results may include packages that are related by their description rather than having the term in their name.
apt-cache search SEARCH_TERM
For example, search for chess-related software with:
apt-cache search chess
The output can contain several package names and descriptions. A result might include dreamchess, along with other chess programs, engines, documentation packages, or libraries.
Broad terms can produce many loosely related results. Narrow the search by using a more specific keyword, then read the descriptions. Do not assume that the first result is the correct application.
Example: finding a chess game
- Run
apt-cache search chess. - Review the package names and descriptions returned by the search.
- Select
dreamchessas a candidate if its description matches the chess application you want. - Inspect the candidate before installing it.
Inspecting package details
Use apt-cache show to display detailed information for an exact package name.
apt-cache show PACKAGE_NAME
For the chess example, run:
apt-cache show dreamchess
Use this output to confirm that the package is the intended application. Check its description and other fields before allowing APT to install it.
| Field | What It Tells the User | Why It Matters Before Installation |
|---|---|---|
| Version | The available release version of the package. | Helps identify which release will be installed and distinguish package records. |
| Architecture | The processor platform for which the package is built. | Confirms that the package is intended for a supported Raspberry Pi architecture. |
| Homepage | The project or application website listed by the package. | Provides additional context about the software and its source project. |
| Package size | The amount of storage used by the package or the amount downloaded, depending on the field shown. | Helps you estimate storage and download requirements. |
| Description | A summary of the package's purpose and contents. | Helps determine whether it is the application you intended to install. |
| Dependencies | Other packages required by this package. | Explains why APT may install additional packages automatically. |
Package information can include separate download-size and installed-size values. The download size affects network usage; the installed size affects available storage after installation.
Installing software with apt-get
After confirming the exact package name, install it with:
sudo apt-get install PACKAGE_NAME
Install the selected chess package with:
sudo apt-get install dreamchess
APT first calculates the requested changes. It may report packages that will be installed, upgraded, or added as dependencies, along with download and disk-space information. Read this summary carefully. When APT asks for confirmation, continue only if the proposed changes are expected.
- Run the installation command.
- Enter your password if
sudorequests it. - Read the list of packages and the download or disk-space summary.
- Confirm the operation when prompted.
The package manager downloads the package files from configured repositories, installs them, and processes required dependencies. A successful installation makes the application available through the system's normal application menus or command-line tools, depending on the package.
Removing software with apt-get
When you no longer need an application, remove it with its exact package name:
sudo apt-get remove PACKAGE_NAME
For the chess example:
sudo apt-get remove dreamchess
Review the removal summary before confirming it. The remove operation uninstalls the application's package, but configuration files may remain so that settings can be preserved if the package is installed again. Removing a package is therefore conceptually different from a full configuration cleanup, which uses a separate cleanup operation and should be considered carefully.
Use the package name, not necessarily the name displayed in an application menu. If you are uncertain, search for the software or inspect its package information before removing it.
APT commands used in this lesson
| Command | Purpose | Example | Requires sudo |
|---|---|---|---|
apt-cache search SEARCH_TERM | Search locally available package metadata for names and descriptions matching a term. | apt-cache search chess | No |
apt-cache show PACKAGE_NAME | Display detailed metadata for an exact package. | apt-cache show dreamchess | No |
sudo apt-get install PACKAGE_NAME | Install a package and required dependencies. | sudo apt-get install dreamchess | Yes |
sudo apt-get remove PACKAGE_NAME | Remove an installed package. | sudo apt-get remove dreamchess | Yes |
Safe and effective command use
- Verify the exact package name with
apt-cache searchandapt-cache showbefore installing or removing software. - Read APT's proposed changes, including dependency packages and disk-space information, before confirming.
- Use
sudoonly when the command needs to modify system-wide files. - Keep in mind that installing software can add several dependency packages.
- Ensure that the Raspberry Pi can reach its configured package sources before attempting a download.
Troubleshooting APT operations
The search returns many unrelated packages
Package searches match terms in names and descriptions. A broad term such as chess can therefore return games, engines, libraries, and documentation. Use a more specific search phrase and inspect likely candidates with apt-cache show.
APT cannot locate the package
The package name may be incorrect, the package may not be provided by enabled sources, or local package metadata may be unavailable or outdated. Search for the intended software again, verify the exact name, and check repository access and package-source configuration.
Installation fails because of permissions
Installing or removing packages without administrative privileges can produce a permission error. Run the operation with sudo using an account authorized to use it.
APT cannot download packages
Check that the Raspberry Pi has a usable network connection and can reach its configured package sources. A search may still display local metadata even when a later download cannot reach the repository.
The package does not seem to be the intended application
A search result alone may not provide enough context. Run apt-cache show PACKAGE_NAME and compare the description, homepage, architecture, version, sizes, and dependencies with the software you want.
End-to-end example
The complete search-to-install workflow for the chess application is:
apt-cache search chess
apt-cache show dreamchess
sudo apt-get install dreamchess
First, search the catalog. Next, inspect dreamchess to confirm its identity and package details. Finally, run the installation command, review APT's proposed changes, and confirm only when the summary is appropriate.
If the application is no longer needed, the corresponding removal command is:
sudo apt-get remove dreamchess
For this lesson's reference topic, see the Raspbian Repository guide.