# Ports & Updates



## CyberTiVo (Oct 23, 2009)

I have a FreeBSD system on a network not connected to the internet and need to add ports and update it regularly.  What is the best way to manage this computer?  I can not connect a computer to the internet and then put it on this network.  I do have one connected to the internet and update it regularly.  Do I copy everything in /usr/ports to a DVD and then copy /DVD/usr/ports to the server on the isolated network.  Then run make install from the correct port directory?  Assuming I have the most current ports installed on the server connected the internet will that work?


----------



## DutchDaemon (Oct 23, 2009)

Copying /usr/ports will not cut it, because the actual source code required to build a port (the tarball) gets downloaded from the Internet on a 'make' command in a port directory. 

You could run a 'make fetch' ('make fetch-recursive' probably) in a port directory on the Internet-connected machine and then copy /usr/ports (including /usr/ports/distfiles, which contains the tarballs) to the disconnected machine (using NFS (preferred), a USB disk/stick or indeed a CD/DVD (very time consuming option!)).

If the machines are similar (same OS version) you can build a port into a package on the Internet-connected machine and simply copy the package to the disconnected machine and install it (and its dependencies) there with pkg_add. Negative side-effect: the ports will have to be installed on the Internet-machine first, so they have to be deinstalled again after that. You'd have to keep track of them and pkg_delete them afterwards.

Mounting /usr/ports over NFS or using rsync to keep the machines' ports trees identical are the easiest and cleanest options, imo, as long as you don't forget to fetch the necessary tarballs and put them in /usr/ports/distfiles on the Internet-side.


----------



## CyberTiVo (Oct 23, 2009)

Thanks.  The 2 servers will always be running the same ports.  When I "make install" them it should download all dependencies into distfiles right? If I do a "make build" does it put the pkg_add file in the current directory?  Does it include all dependencies?


----------



## DutchDaemon (Oct 23, 2009)

To build packages from ports (including dependencies) there is a command called [cmd=]make package-recursive[/cmd]. This will a) install the port and its dependencies on the server where this command is run b) create installable packages in /usr/ports/packages/All/ which can be installed elsewhere with [cmd=]pkg_add[/cmd].

There are other ways, e.g. using ports-mgmt/portmaster or ports-mgmt/portupgrade, which both have the ability to build packages from ports. Look into the -g flag of portmaster(8) or the -p flag of portupgrade(1). I'm not sure where they place the packages, because I never build packages myself  These tools will also help you upgrade ports/packages when newer versions arrive.


----------



## CyberTiVo (Oct 24, 2009)

Thanks


----------



## CyberTiVo (Oct 28, 2009)

The "make package-recursive" is working perfectly


----------



## SirDice (Oct 28, 2009)

As far as I know all the tools pretty much work the same with regard to where the packages end up. If /usr/ports/packages doesn't exist and PKGDIR isn't set the package will be created in the port's directory. Otherwise it will go to wherever PKGDIR points or /usr/ports/packages.


----------

