How to setup Debian ubuntu local ISO repository

In this tutorial we will setup a ubuntu local ISO repository. On a Linux system, it’s possible to specify a different source for software installation in the package manager. This means you don’t always have to download packages from official repositories.

One hack that can prove handy is to use a distro’s ISO file as an installation source. This way, you don’t have to waste bandwidth and time downloading packages from online in official repos, provided that the software is available on the ISO file.

In this tutorial, you will learn how to use an ISO file as an installation repository on Debian and Ubuntu Linux.

In this tutorial you will learn:

  • How to use ISO file as installation source
How to setup Debian/Ubuntu local ISO repository
How to setup Debian/Ubuntu local ISO repository
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian and Ubuntu Linux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Add ISO image to apt sources.list




Follow the steps below to add your ISO image to Debian or Ubuntu’s sources.list file, then utilize it to install software locally.

  1. Let’s assume that we have a Debian ISO image downloaded at the location: ~/debian.iso. As a first step, we need to create a mount point to where this ISO image will be mounted to, and then mount the ISO file.
    $ sudo mkdir /mnt/debian-iso
    $ sudo mount ~/debian.iso /mnt/debian-iso -o loop
    
  2. Next, open up the /etc/apt/sources.list with nano or your favorite text editor.
    $ sudo nano /etc/apt/sources.list
    
  3. Inside this file, add your repo to the bottom.
    deb file:/mnt/debian-iso/ bullseye main contrib
    

    Note that in our example we are using bullseye, but you should replace this text with the codename of your distribution’s version.

  4. After closing the sources file and saving the changes, you can update your repository lists.
    $ sudo apt update
    



  5. Then, finally, install some software from the ISO file.
    $ sudo apt install ssh
    

Closing Thoughts

In this guide, we saw how to use an ISO file as an installation source on Debian and other Debian-based Linux distributions such as Ubuntu. Adding the ISO file to your system’s sources.list file will come in handy if you have a slow internet connection, or even no internet connection at all. This way you can use Ubuntu local ISO repository even offline.