Is there any way to just download all Ubuntu repositories using apt-get? I am looking for something like :

sudo apt-get install --download-only *

So that I can access the downloaded repository in the directory /var/cache/apt/archives/.

  • possible duplicate of How can I install software or packages without Internet (offline)?
    – muru
    Oct 2, 2014 at 12:54
  • Yeah. Indeed i have changed the address of the repositories to a local computer and i want to download all from there.
    – Nejat
    Oct 2, 2014 at 12:55
  • You probably wan't something like: apt-mirror.github.io
    – azzid
    Oct 2, 2014 at 12:57
  • I have tried that but it does not work properly when i change the address of the repositories in mirror.list. Where as the same addresses work well when defined in sources.list. So i am looking for an alternate way.
    – Nejat
    Oct 2, 2014 at 12:59
  • Do you have enough disk-space to house all of those packages?
    – blade19899
    Oct 2, 2014 at 13:00

2 Answers 2


First of all, this is not a convenient way. Instead of this you should use the method mention here. But as an answer to the question.

  • First create a file which contains names of all the available packages using apt-cache.

    apt-cache  dumpavail |grep -oP "(?<=Package: ).*" >> packagelist

    This will create a file packagelist with all the available packages.

  • Now create a simple script to download all the packages present in the file packagelist

    for package in `cat packagelist`
        apt-get install -y --download-only $package   
  • Save it.

  • Make it executable using

    chmod +x your_script_name
  • Now open terminal and login as root

    sudo -i
    cd /folder/of/you/script

It will download all the available package depending upon your /etc/apt/sources.list in /var/cache/apt/archives directory


You can use a tool called apt-cacher. You can check this link for more info. Hope it helps.

  • This does not get all repositories. When you get some packages just those are cached. I want some way to cache them all.
    – Nejat
    Oct 2, 2014 at 13:14
  • Then you can use apt-mirror check this link Oct 2, 2014 at 13:51

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.