Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 7 down vote accepted

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
share|improve this answer

Just try:

cd /directory
apt-get download package_name*
share|improve this answer
note that this will work for distros >= raring – mattexx Sep 16 '14 at 18:08

You can edit file /etc/apt/apt.conf and add this:

Dir::Cache::Archives "/path/you/want/";

Note that from now on, all downloaded files by apt will be stored on that dir. To disable it, you only need to comment that line (with #)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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