Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 4 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
add comment

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
add comment

Just try:

cd /directory
apt-get download package_name*
share|improve this answer
add comment

Your Answer

 
discard

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.