# Cache pkg ng downloads for multiple installations?



## FreeBSoD (Nov 12, 2013)

Hello,

I want to install some binary packages, of course. But I also need some of those packages in a jail. Is there a way PKGNG can 'cache' (like in a local repository or something) certain packages it downloads so that I can later install them in my jail without having to re-download all the said packages over again?

Thanks.


----------



## Beastie (Nov 12, 2013)

FreeBSoD said:
			
		

> Is there a way pkg ng can 'cache' (like in a local repo or something) certain packages it downloads so that I can later install them in my jail without having to re-download all the said packages over again?


This is already done by default. Check `man 5 pkg.conf`:


> PKG_CACHEDIR: string
> Specifies the cache directory for packages.
> The default value for this option is /var/cache/pkg



So you should find all the packages that have been downloaded so far in /var/cache/pkg.
And you may also set a different path in your /usr/local/etc/pkg.conf file, like so:

```
PKG_CACHEDIR: /some/path
```


----------



## wblock@ (Nov 12, 2013)

That's a local cache.  The files can be copied, but it sounded like @FreeBSoD wanted something more like a proxy cache.  www/squid might work for that.


----------



## FreeBSoD (Nov 13, 2013)

Ah that feels like a stupid question now, thanks.

@wblock@, I was actually hoping for a "local repository" of sorts, however, mounting the cache in various places will suffice.


----------

