Mirror Ubuntu Repository Using Nexus Repository for Fast and Efficient Linux Package Management

Mirror Ubuntu Repository Using Nexus Repository for Fast and Efficient Linux Package Management

Mirroring Ubuntu Repository Using Nexus Repository – Complete Guide

Ubuntu Oct 10, 2025

In infrastructure management, time and bandwidth efficiency are crucial factors. One of the best ways to achieve this is by mirroring Ubuntu repositories using Nexus Repository.
By doing so, you can store a local copy of the official Ubuntu repository, allowing systems to perform apt update or apt install without connecting to the internet β€” they simply access packages directly from your local Nexus server.

If you haven’t installed Nexus yet, you can follow this detailed guide:
πŸ‘‰ Complete Guide to Installing Nexus Registry with Docker for Efficient Container Management
This tutorial explains how to set up Nexus Repository using Docker, providing a solid foundation before proceeding with Ubuntu repository mirroring.

This article provides a step-by-step guide on how to create an Ubuntu repository mirror for multiple versions β€” from Ubuntu 18.04 (Bionic), 20.04 (Focal), 22.04 (Jammy), up to the latest 24.04 (Noble).
With this multi-version support, system administrators can ensure that all Ubuntu nodes in production or testing environments have fast and consistent access to the required packages.

Nexus Repository acts as a caching proxy, storing packages from official Ubuntu sources such as archive.ubuntu.com and security.ubuntu.com.
You can configure it to perform automatic synchronization, saving bandwidth and accelerating package installations across your internal network.

Create Repository

  1. Go to Repositories -> + Create repository -> apt (proxy)-> Create Repository
byamricom | Creating Nexus Repository
byamricom | Creating Nexus Repository
byamricom | Creating Nexus Repository
byamricom | Creating Nexus Repository
  1. Then enter the following values :
Name: ubuntu-archive
Distribution: noble,jammy,focal,bionic
Remote Storage: http://archive.ubuntu.com/ubuntu/

Name: ubuntu-security
Distribution: noble,jammy,focal,bionic
Remote storage: http://security.ubuntu.com/ubuntu/
byamricom | Creating Nexus Repository
byamricom | Creating Nexus Repository
byamricom | Creating Nexus Repository
byamricom | Creating Nexus Repository
  1. Create the file: /etc/apt/source.list.d/ubuntu-local.list
deb https://nexus.byamri.com/repository/ubuntu-archive focal main restricted
deb https://nexus.byamri.com/repository/ubuntu-archive focal-updates main restricted
deb https://nexus.byamri.com/repository/ubuntu-archive focal universe
deb https://nexus.byamri.com/repository/ubuntu-archive focal-updates universe
deb https://nexus.byamri.com/repository/ubuntu-archive focal multiverse
deb https://nexus.byamri.com/repository/ubuntu-archive focal-updates multiverse
deb https://nexus.byamri.com/repository/ubuntu-archive focal-backports main restricted universe multiverse

deb https://nexus.byamri.com/repository/ubuntu-security focal-security main restricted
deb https://nexus.byamri.com/repository/ubuntu-security focal-security universe
deb https://nexus.byamri.com/repository/ubuntu-security focal-security multiverse

Result

byamricom | Creating Nexus Repository

With this setup, you can significantly optimize your Ubuntu infrastructure β€” speeding up package installations, improving system stability, and reducing dependency on external internet connections.

Reference:

APT Repositories

Tags

Roby Yasir Amri

I am interested in technological developments related to Cloud Computing, Linux, DevOps, Scripting, and Programming.