# HOWTO: Install binary package without internet acces.



## Handy92 (Apr 30, 2017)

I read some Topics and I do not find correct solution so, I write own, correctly and working solution. Extenged for my situation.  

1. Download IMG, and DVD iso file. 
2. Burn IMG to memstick using dd() 
`dd if=/path/to/iso of=/path/to/memstick bs=1M conv=sync`
3. Install system. 
4. Copy DVD1.iso to memstick. 
5. `mkdir /cdrom`

*6.* Mount DVD1:

```
#mount -t cd9660 /dev/mdX /cdrom
```
or mount DVD.iso file from memstick:

```
6.a - mount memstick. 
#mount -t msdosfs -o large /dev/da0s1 /mnt

6.b - loopback dervice
#mdconfig -a -t vnode -f "/mnt/PATH_TO ISO_FILE/DVD1.ISO"

6.c - mount dervice.
#mount -t cd9660 /dev/mdX /cdrom
```

7. Now do to mounted file system and copy:

```
cp /cdrom/etc/pkg/FreeBSD.conf /etc/FreeBSD.conf

and 

cp /cdrom/etc/freebsd-update.conf /etc/freebsd-update.conf
```

8. NOW The most important part
go to cdrom and copy FreeBSD_install_cdrom.conf

`cd /cdrom/packages/repos/` and copy FreeBSD_install_cdrom.conf to YOUR /etc directory. 


```
cp /cdrom/packages/repos/FreeBSD_install_cdrom.conf /etc/pkg/FreeBSD_install_cdrom.conf
```

Now READ the f... file. (and manual ofcourse)

`ee /etc/pkg/FreeBSD_install_cdrom.conf`
Then we see this:

```
#
# $FreeBSD: releng/11.0/release/scripts/FreeBSD_install_cdrom.conf 266554 2014-05-22 19:25:41Z gjb $
#
# The pkg(8) repository configuration file for the installation DVD.
#

FreeBSD_install_cdrom: {
  url: "file:///dist/packages/${ABI}",
  mirror_type: "none",
  enabled: yes
}

FreeBSD: {
  enabled: no
}
```

Change URL to correct value (packages directory from ISO or DVD) for me is:

FROM: `url: "file:///dist/packages/${ABI}",` TO:  `url: "file:///cdrom/packages/${ABI}",`

This part disable exist pkg configuration.

```
FreeBSD: {
  enabled: no
}
```

Pres escape KEY and save change. 

Now write PKG into root console, and YES, machine will download PKG from mounted file system. Install whatever YOU want, after that remove /etc/pkg/FreeBSD_install_cdrom.conf.

DONE. Easy.


----------

