How To Install apt-cacher on Debian 11

In this tutorial we learn how to install apt-cacher on Debian 11. apt-cacher is Caching proxy server for Debian/Ubuntu/Devuan software repositories

Introduction

In this tutorial we learn how to install apt-cacher on Debian 11.

What is apt-cacher

apt-cacher is:

Apt-cacher performs caching of files requested by apt-get (or other APT clients such as aptitude or synaptic). Apt-cacher can also proxy Debian Bugs SOAP requests for apt-listbugs. It is most useful for local area networks with limited network bandwidth or to reduce multiple large downloads.

When a file or package is requested, apt-cacher checks whether it already has the requested version, in which case it fulfils the request immediately. If not, it downloads the package while streaming it to the client at the same time. A local copy is then kept for any subsequent requests.

Apt-cacher has been optimized for best utilization of network bandwidth and is efficient even on slow or low-memory servers. Multiple ways of installation are possible: as a stand-alone proxy, as a daemon executed by inetd or as a CGI program (deprecated). Client machines are configured by changing APT’s proxy configuration or modification of access URLs in sources.list.

The package includes utilities to clean the cache (removing obsolete package files), generate usage reports and import existing package files. Optional features include a file checksum verification framework, IPv6 support, FTP and HTTPS (proxying only) support as well as the simultaneous caching of repositories from different distributions.

Apt-cacher can be used as a replacement for apt-proxy, with no need to modify client’s /etc/apt/sources.list files (and even reusing its config and cached data), or as an alternative to approx.

There are three methods to install apt-cacher on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install apt-cacher Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install apt-cacher using apt-get by running the following command:

sudo apt-get -y install apt-cacher

Install apt-cacher Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install apt-cacher using apt by running the following command:

sudo apt -y install apt-cacher

Install apt-cacher Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install apt-cacher using aptitude by running the following command:

sudo aptitude -y install apt-cacher

How To Uninstall apt-cacher on Debian 11

To uninstall only the apt-cacher package we can use the following command:

sudo apt-get remove apt-cacher

Uninstall apt-cacher And Its Dependencies

To uninstall apt-cacher and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove apt-cacher

Remove apt-cacher Configurations and Data

To remove apt-cacher configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge apt-cacher

Remove apt-cacher configuration, data, and all of its dependencies

We can use the following command to remove apt-cacher configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge apt-cacher

Dependencies

apt-cacher have the following dependencies:

References

Summary

In this tutorial we learn how to install apt-cacher package on Debian 11 using different package management tools: apt, apt-get and aptitude.