# Pkg local repo mirror



## boris_net (Oct 7, 2014)

Hi all,

I have multiple hosts/jails and was looking at the best way to get a local pkg repo. I was thinking of dedicating a jail that would update itself once a week by mirroring a public repo overnight during my off-peak hours. I came across an HOWTO using Poudriere but I am not entirely sure whether I need the packages to be built rather than just downloading pre-built packages. Is there any pointer/best practices on creating a local repository for packages on FreeBSD 10? I use exclusively PKGNG which has been working great so far.

Thanks in advance.


----------



## Beeblebrox (Oct 10, 2014)

If you are thinking of something like apt-cache, FreeBSD does not have that.



> I am not entirely sure whether I need the packages to be built rather than just downloading pre-built packages.


It's entirely up to you. You can go either way.

If you want to use downloaded packages, take a look at pkg.conf(5) and set the PKG_CACHEDIR variable. You need to also set PKGREPOSITORY in environment to that path. Export that folder via NFS or HTTP for your other hosts. For jails, you will need to null-mount that folder to the jail if you want to use `# pkg -j <jailname> upgrade`.


----------

