I have a Ubuntu machine that is not allowed to be connected to the network and it is locally connected to a Windows machine. Due to security requirements, this machine is disallowed from network connectivity. I want to set up a local repository on the machine so that if I ever need a package I can simply use the apt package manager to install my packages. I'm having difficulty finding relevant resources on how to setup an Ubuntu repository that don't assume you have apt/internet activity. (The classic chicken-and-egg problem.)

In this case, my offline machine has a little help, i.e., a network-connected Windows machine that can download all the software it requires, except no instructions explain how to set up an Ubuntu repository that isn't already part of the Ubuntu ecosystem.

I have set up RHEL repositories in this manner because they use the ISO install disks as their repositories. That is straightforward once you understand how to mount the ISO onto the file system. In the case of Ubuntu, most directions have tools that only a network-connected Ubuntu machine with apt can use.

How can someone set up an Ubuntu repo that has no access to network resources from the get-go?

  • 1
    Or you could just download the files you need on the Windows machine and sneakernet them to your Ubuntu machine. That'll save you the resources necessary to download, maintain, and store multiple local repositories. apt-get --print-uris -y install <package> | grep ^\' | cut -d\' -f2 > get.txt will create file "get.txt" on your Ubuntu machine. It's a list of URLs you can then move to your Windows machine and use wget -i get.txt (or some other download manager) to download in a batch.
    – MDeBusk
    Aug 7 at 16:41
  • 1
    That's neat. I was really hoping to just go with the convenience of setting up a repo however. Being able to use offline Ubuntu the same way as online Ubuntu is user-friendly. Tho your suggestion at least gets me over the initial headache of dependency hell when installing a tool.
    – LeanMan
    Aug 8 at 3:25

1 Answer 1


Edit: After reading for a second time, I've realized that you want to create a mirror on your offline Ubuntu machine. Using a second machine, that runs a Debian based distro, would be a lot easier, but if you have no other option than using a non-Linux OS to help, that is over my knowledge and I think it would require overcomplicated solutions. Nevertheless, I leave my solution untouched if you can't find any other solution.

Kind of a similar question to this.

The answer here seems to be able to solve their problem. Note that this solution requires a second Ubuntu machine (Physical or Virtual) with ~15-20 GB space per mirror.

See if this works for you too.

  • thanks but still it seems they gloss over the actual part of creating the offline repo offline. This is such a difficult problem. On Redhat it was sooo simple. I thought it would have been simple on Ubuntu too but its not.
    – LeanMan
    Aug 8 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.