Download Packages With Dependencies Locally In Ubuntu

12 Responses

  1. jack says:

    Awsome!! Thank you so much 🙂

  2. Mr MZLPCZK says:

    This is exactly the info I needed.

  3. Ashish says:

    Thank you soo much 😉😉😉
    Loved your content & the simplicity of your explanation…
    Keep it up

    -Love from India 🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳🇮🇳

  4. douirc says:

    Thank you for the post. Is it possible the dependencies have dependencies? Is there a way to rewrite the script to download dependencies recursively? Also, if your package has multiple dependencies, how does dpkg -i * know what order to install the packages to avoid errors?

    • sk says:


      For Question 1 – Yes, It is possible the dependencies may have other dependencies.

      Question 2 – Yes, we can download the dependencies recursively. The following command will download the dependencies of Vlc package recursively in the current directory.

      apt-get download $(apt-cache depends –recurse –no-recommends –no-suggests –no-conflicts –no-breaks –no-replaces –no-enhances vlc | grep “^\w” | sort -u)

      Question 3 – I don’t know the answer on top of my head right now. May be you should refer man pages of dpkg command.


  5. Bob says:

    Very useful info, thank you very much SK!

  6. iris says:

    hi thank you i want use this method for installed package how i do
    i search in google and find it can with dpkg-repack
    i want backup installed package and his dependencies for use later offline

  7. Dave says:

    Hi nice info!! Can you bundle this into an sh script that can receive the package as parameter ( “ python” where is the script and python any package ) then the script will do:
    1 – Create a folder “python-installer” (where python is the package name provided)
    2- Download the package dependencies and recursive dependencies.
    3- Compress all downloaded packages in a file (resources.tgz for example) and clean the folder.
    4- Create a script inside the folder with the name “” this script will do:
    —1- extract all the packages in a temp folder an run the “sudo dpkg -i *” command on it

    Recapitulating, we will have in our USB memory:
    | python-installer ( folder )
    |—–resources.tgz ( compressed .deb packages )
    |—– ( script for auto installation )

    I don’t have the skills to do that, it will be awesome if you can make it

    • sk says:

      Hi Dave,

      I don’t have much knowledge in scripting/programming. Please post your question in Stackoverflow or /r/linuxquestions. Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.