# APT repository mirrors

How to configure a Linux machine to use APT repository mirrors

## Configuring APT to use them

Make certain you make a backup of the files you will be editing below in-case you make a mistake.

Not doing so could cause you not to be able to make any further updates to your machine!

To switch over to using your new proxy you need to edit the apt sources files under /etc/apt/ then run apt-get update.

If you have followed the naming conventions above you can go in to /etc/apt/sources.list and replace any reference to the remote storage url in nexus with the new path.

You should also do this for anything in the /etc/apt/sources.list.d/ directory - but only those you have configured a proxy for!

For example, if your local nexus is accessible at http://10.11.12.13:8081/ then for the apt-ubuntu-archive proxy changing http://gb.archive.ubuntu.com/ubuntu in sources.list with http://10.11.12.13:8081/repository/apt-ubuntu-archive/

For example:

1deb http://gb.archive.ubuntu.com/ubuntu focal main restricted


becomes:

1deb http://10.11.12.13:8081/repository/apt-ubuntu-archive/ focal main restricted

Do not change the distribution field, e.g. focal-updates above. They should match that of the remote repository. Do not replace them with the value in the proxy!
1sudo apt-get update