Solved Using Jail host as a cache server for pkg and freebsd-update

antranigv

New Member

Reaction score: 3
Messages: 15

Hi all! how are you? :)

I have a Jail host which contains about 50 Jails. During day-to-day operations, I need to install packages, a lot of these packages are the same (nginx, vim-console, etc), it would be really good if I can make the Jail host a pkg cache server, where the Jails can use the host's fetched packages.

Also, since I keep all of my Jails up-to-date, what's the best way to keep a local freebsd-update server? Same as above but for freebsd-update :)

Thanks in advance!
 

Neals

New Member

Reaction score: 3
Messages: 5

Couldn't you just mount /var/cache/pkg into all your jails to share the binary packages over all jails?
Othervise just take a look into man pkg-repo, mount this into your jails and use a url with "file://" in your specific pkg.conf.

I use pkg -c "${path_to_jail}" install -y "${package}", then the pkg is executed on the host and the jails does not even need to bootstrap pkg.
 

Mjölnir

Daemon

Reaction score: 1,504
Messages: 2,114

You can use a common HTTP & FTP proxy. Ideally, on the same jail set up a /usr/local/share/doc/freebsd/en/articles/freebsd-update-server
2nd, naive solution: null-mount /var/cache/pkg into the jails. pkg(8) looks up packages to fetch from there 1st. Dito: /usr/ports/distfiles.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,323
Messages: 38,841

Also, since I keep all of my Jails up-to-date, what's the best way to keep a local freebsd-update server? Same as above but for freebsd-update
I would suggest just setting up a caching proxy for this. Setting up an actually update server is a bit of a pain to set up and maintain. A caching proxy will do the trick just fine.
 
OP
antranigv

antranigv

New Member

Reaction score: 3
Messages: 15

For pkg I ended up using nullfs, which I totally forgot about when posting this, thanks for reminding me :) it's been working like a charm.

For freebsd-update, I have not looked into it much yet, but I'll try a caching proxy, if there's any recommended HowTo, please post below for other people as well.

Marking as Solved.

Thank you all :)
 

Mjölnir

Daemon

Reaction score: 1,504
Messages: 2,114

For pkg I ended up using nullfs, which I totally forgot about when posting this, thanks for reminding me :) it's been working like a charm. For freebsd-update, I have not looked into it much yet, but I'll try a caching proxy, if there's any recommended HowTo, please post below for other people as well.
SirDice posted a configuration snippet for www/nginx here.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,323
Messages: 38,841

Yes, I can also post an Apache config if you're interested. It does the exact same thing as the nginx config I posted. They both set up a virtual host to proxy and cache specifically for update.freebsd.org.
 
Top