How To Install apt-mirror on Ubuntu 22.04

In this tutorial we learn how to install apt-mirror on Ubuntu 22.04. apt-mirror is APT sources mirroring tool

Introduction

In this tutorial we learn how to install apt-mirror on Ubuntu 22.04.

What is apt-mirror

apt-mirror is:

A small and efficient tool that lets you mirror a part of or the whole Debian GNU/Linux distribution or any other apt sources.

Main features:

  • It uses a config similar to apts <sources.list>
  • It’s fully pool comply
  • It supports multithreaded downloading
  • It supports multiple architectures at the same time
  • It can automatically remove unneeded files
  • It works well on overloaded channel to internet
  • It never produces an inconsistent mirror including while mirroring
  • It works on all POSIX compliant systems with perl and wget

There are three methods to install apt-mirror on Ubuntu 22.04. 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-mirror 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-mirror using apt-get by running the following command:

sudo apt-get -y install apt-mirror

Install apt-mirror Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install apt-mirror

Install apt-mirror 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 Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install apt-mirror

How To Uninstall apt-mirror on Ubuntu 22.04

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

sudo apt-get remove apt-mirror

Uninstall apt-mirror And Its Dependencies

To uninstall apt-mirror and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove apt-mirror

Remove apt-mirror Configurations and Data

To remove apt-mirror configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge apt-mirror

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

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

sudo apt-get -y autoremove --purge apt-mirror

References

Summary

In this tutorial we learn how to install apt-mirror package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.