Ubuntu – How to direct apt-get to download package and its dependencies to some other location

aptinstallationpackage-management

How can I direct apt-get install package_name to download package and its dependencies to some other location instead of /var/cache/apt/archives?

Best Answer

  • You can download a package and all its dependencies with the following command, provided neither the package nor its dependencies are installed in the machine:

    sudo apt-get --download-only -o Dir::Cache="/path/to/destination/dir/" \
        -o Dir::Cache::archives="./" install package_name