# one ports/distfiles/packages structure for few servers



## wszczep (Dec 7, 2012)

Hi all,

I've got few servers in my rack, both amd64 and i386 with the same FreeBSD release installed.
I came to the idea that I could benefit from keeping ports and distfiles structure on one of them, install and/or create packages on it - and supply them via nfs to other machines. So I did following:

```
main# zfs list
tank/ports                 1.61G   626G  1.17G  /usr/ports
tank/ports/distfiles        151M   626G   151M  /usr/ports/distfiles
tank/ports/packages.amd64   214M   626G   214M  /tank/ports/packages.amd64
tank/ports/packages.i386   87.4M   626G  87.4M  /tank/ports/packages.i386
```
on "main amd64" server. I have noticed that I cannot "zfs set sharenfs=on" option on not mounted zfs filesystem i.e. created with "zfs set mountpoint=none". That's why there are both packages.amd64 and .i386 filesystems. I have also created symlink /usr/ports-packages to /tank/ports/packages.amd64

Then on each "client" server I mounted nfs shares as follows:

```
client_i386# cat /etc/fstab
10.180.1.2:/usr/ports                /usr/ports           nfs rw,noatime 0 0
10.180.1.2:/usr/ports/distfiles      /usr/ports/distfiles nfs rw,noatime 0 0
10.180.1.2:/tank/ports/packages.i386 /usr/ports-packages  nfs rw,noatime 0 0

client_amd64# cat /etc/fstab
10.180.1.2:/usr/ports                 /usr/ports           nfs rw,noatime 0 0
10.180.1.2:/usr/ports/distfiles       /usr/ports/distfiles nfs rw,noatime 0 0
10.180.1.2:/tank/ports/packages.amd64 /usr/ports-packages  nfs rw,noatime 0 0
```
and setenv option PACKAGES to /usr/ports-packages on all "main" and "client" servers.

At portmaster.rc file (as I am using portmaster to maintain installed ports) I have set LOCAL_PACKAGEDIR=/usr/ports-packages
This way I was able to compile from sources and install some port on "main" server, and then later on install it from previously created package on "client" server.

Question: Is that a good solution? Does anybody have it done better?


----------



## SirDice (Dec 7, 2012)

Just mount 10.180.1.2:/tank/ports/package.{i386|amd64} on /usr/ports/packages.

No need for a different mountpoint on the server either. It doesn't cause any harm in having a /usr/ports/packages.i386/ and /usr/ports/packages.amd64.


----------



## wszczep (Dec 7, 2012)

SirDice said:
			
		

> Just mount 10.180.1.2:/tank/ports/package.{i386|amd64} on /usr/ports/packages.
> 
> No need for a different mountpoint on the server either. It doesn't cause any harm in having a /usr/ports/packages.i386/ and /usr/ports/packages.amd64.



But what will happen if I do on "main amd64":

```
main# zfs list
tank/ports                 1.61G   626G  1.17G  /usr/ports
tank/ports/distfiles        151M   626G   151M  /usr/ports/distfiles
tank/ports/packages         214M   626G   214M  /usr/ports/packages
tank/ports/packages.i386   87.4M   626G  87.4M  /tank/ports/packages.i386
```
and then mount on "clent i386" nfs shares as:

```
client_i386# cat /etc/fstab
10.180.1.2:/usr/ports                /usr/ports           nfs rw,noatime 0 0
10.180.1.2:/usr/ports/distfiles      /usr/ports/distfiles nfs rw,noatime 0 0
10.180.1.2:/tank/ports/packages.i386 /usr/ports/packages  nfs rw,noatime 0 0
```
Will I have on client i386 packages (3rd mount command) or inherited amd64 packages (1st mount command)? On main server packages are nested into /usr/ports and this is also exported, I guess.
For the all amd64 servers, there would be no problem - but I've got one i386


----------



## SirDice (Dec 7, 2012)

wszczep said:
			
		

> ```
> tank/ports/packages         214M   626G   214M  /usr/ports/packages
> tank/ports/packages.i386   87.4M   626G  87.4M  /tank/ports/packages.i386
> ```


Just use:

```
tank/ports/packages.amd64 /usr/ports/packages.amd64
tank/ports/packages.i386 /usr/ports/packages.i386
```
You can set PACKAGES to /usr/ports/packages.amd64 on the server.



> Will I have on client i386 packages (3rd mount command) or inherited amd64 packages (1st mount command)?


The only things that are 'inherited' are the ZFS options, not the contents of the filesystem.



> On main server packages are nested into /usr/ports and this is also exported, I guess. For the all amd64 servers, there would be no problem - but I've got one i386


If you only have one I'd just do:

```
tank/ports/packages /usr/ports/packages
tank/ports/packages.i386 /usr/ports/packages.i386
```
And mount /usr/ports/packages on the amd64 servers and /usr/ports/packages.i386 on the i386. There's no problem in doing this, it's a different filesystem so it won't get exported with /usr/ports/. Although you will have a /usr/ports/packages.i386 directory on the amd64 clients, it will be empty.


----------



## jb_fvwm2 (Dec 7, 2012)

Can they/it use thumbdrives?

```
# /dev/da0  ... /portmaster-download #
mount -t ufs -o union /dev/da0 /usr/ports/packages
# [FILE]/usr/ports/packages/portmaster-download[/FILE] should appear.
#
# As an example of a CLI to maybe further implement...
```
Some server rooms/racks may find it easier that way (Very unsure about this instance, though.)


----------

