# Using ports and packages on an offline PC



## Tomte (Oct 3, 2013)

Hi,

I'm a long time Linux user, have always eyed FreeBSD with some interest, and finally decided to really try it. So I downloaded FreeBSD 9.2, read quite a few parts of the Handbook (although I certainly missed a lot), and am going to install it on one of my machines at home. Thing is, this computer has no network connectivity whatsoever (except sneakernet via USB stick), and won't get any. So is that really feasible?

The DVD I downloaded seems to contain a base set of packages in the directory packages/All, but it's obviously only a basic selection to get the system up and running. And I'd actually like to use the ports system, as well. So my question is basically this:

Is there an officially documented (or missing that, at least a practicable) way to use the ports and packages system in some kind of "offline mode", where the system gives me a list of files (with URLs) that it wants downloaded, I get these files on another PC, put them in some place on the network-handicapped PC and just use that to install what I want?

Obviously you can parse the ports control files and so on, but I'm looking for a newbie-friendly way. FreeBSD is scary enough. I don't need to do really complicated stuff right now.


----------



## SirDice (Oct 3, 2013)

You can do `make fetch-recursive` in a port directory on a networked FreeBSD. Then transfer the files in /usr/ports/distfiles/ to the non-networked FreeBSD. That should give you enough to build a port.

But you really want to network the FreeBSD machine, it'll make life a lot easier as pretty much everything assumes you're online.


----------



## jb_fvwm2 (Oct 3, 2013)

There is a method that is not at all newbie, but is easy once one knows the few gotchas. However, it continually encounters one problem I've found unsolvable without internet connectivity, at least unless one is using the new PKGNG. The following should hint at searches within this forum where I've posted it [the procedure, not the gotcha ] several times: `mount -o union /dev/da0 /usr/ports/packages`

I expect to use it from here on, on almost all of the machines except the primary one here.  [And mount the thumbdrive to /mnt several times also, during each upgrade].  But the upgrades proceed quicker than if the machines were upgrading without most of the packages already built and available.


----------



## Tomte (Oct 3, 2013)

SirDice said:
			
		

> You can do `make fetch-recursive` in a port directory on a networked FreeBSD. Then transfer the files in /usr/ports/distfiles/ to the non-networked FreeBSD. That should give you enough to build a port.



Thank you! I guess I'll have a test run later today or tomorrow with a networked FreeBSD installation in a Virtualbox.


----------



## Tomte (Oct 3, 2013)

jb_fvwm2 said:
			
		

> There is a method that is not at all newbie, but is easy once one knows the few gotchas. However, it continually encounters one problem I've found unsolvable without internet connectivity, at least unless one is using the new [cmd=] pkgng [/cmd]. The following should hint at searches within this forum where I've posted it [the procedure, not the gotcha ] several times: `mount -o union /dev/da0 /usr/ports/packages`
> 
> I expect to use it from here on, on almost all of the machines except the primary one here.  [And mount the thumbdrive to /mnt several times also, during each upgrade].  But the upgrades proceed quicker than if the machines were upgrading without most of the packages already built and available.



Thank you!

I suppose it's http://forums.freebsd.org/archive/index.php/t-36190.html?

Using PKGNG would not be a problem. As it seems to be the future, I intend to use it, bringing no old baggage with me.

What are the gotchas you mentioned?


----------



## SirDice (Oct 3, 2013)

Depending on how fast your virtual machine is you could also build your own packages there and only transfer those to the off-line FreeBSD machine. If you create /usr/ports/packages/ and do `make package-recursive` in a port directory, packages will be created in /usr/ports/packages/. Although if you do go down the package road I'd recommend using ports-mgmt/portmaster and ports-mgmt/pkg. The first makes building ports a whole lot easier to manage and the latter is the new package management tool which will replace the aging pkg_add(1) and friends in FreeBSD 10.0.


----------



## jb_fvwm2 (Oct 3, 2013)

The gotchas? A [cmd=] pkg_add (or) pkg_add -f [/cmd] error (cannot find some dependency...; a terse  "leave_playpen"; several others ...). Also, there are several ways of upgrading on the target machine; even so far as to make the unionfs up one level in the directory tree so that /usr/ports is on the thumbdrive.


----------

