# share custom-built packages with other hosts



## _martin (Aug 1, 2018)

Many of my jails and VMs use ports to update packages.  Lots of these packages share the same configuration. In many scenarios once the package is built others can use it and don't need to built it up themselves.
To speed up the update I pay attention to several packages such as clang, gcc, ruby and intervene manually. Once package is built on main host I create the package and install it on other hosts:


```
server# pkg create -o spool -f txz gcc6-6.4.0_8
client# pkg delete -f gcc6
client# pkg add -f gcc6-6.4.0_8.txz
```

and then I let the clients continue with the upgrade.

My question is if there's a tool that would do this for me. All hosts in question use ports and portupgrade(1) to upgrade the packages.  I could create a script that saves the output of `pkg version -vIL=` and checks if such package already exists in spool directory. I was wondering if I'm not reinventing a wheel here ..


----------



## ShelLuser (Aug 1, 2018)

If you wish to set something up manually (it's easier than it looks) then pkg-repo(8) is an excellent tool to set up a package repository based on what you currently have. You may also want to use pkg-create(8) to actually build packages out of the software you currently have installed.

I personally also rely on ports-mgnt/portmaster which can be instructed to keep a package of whatever port you build and copy it to /usr/ports/packages/All. After you have that set up it's extremely easy to build a repository out of that using pkg-repo(8).

Of course there's also software around which can do all of this for you automatically. The most popular one (to my knowledge) is ports-mgmt/poudriere which is also used to maintain the FreeBSD software repositories.

Hope this can help.


----------



## _martin (Aug 1, 2018)

ShelLuser said:


> You may also want to use pkg-create(8) to actually build packages out of the software you currently have installed


Well yeah, that's what I'm doing in my example above. 



ShelLuser said:


> I personally also rely on ports-mgnt/portmaster which can be instructed to keep a package of whatever port you build and copy it to /usr/ports/packages/All


That would be what I'm after. If portmaster can identify that the version of the package in ports has been already built and doesn't require building again that would be perfect.

Creating my own solution is not hard, but does require some time. I wanted to check with the community here if somebody did that already and spare me some time. And maybe let the info for others who may have the same issue to solve.


----------

