# 'iocage fetch' from a local repository



## Bucky (Jul 9, 2015)

Here is a fix that works with either the regular `iocage fetch` to the ftp.FreeBSD.org repository or with a locally created repository not running an httpd daemon.

On the local repository server set up the ftpd thus:

Add the following to /etc/rc.conf:

```
ftpd_enable="YES"
ftpd_program="/usr/libexec/ftpd"
ftpd_flags="-Arl -a 10.0.0.1"
```

Add the user ftp thus:

```
# adduser
no password
```
Put the RELEASE distribution *.txz files in the /home/ftp directory.  These files can be found either at freebsd.org in the /pub/FreeBSD/releases/amd64/10.1-RELEASE/ directory, or inside the release .iso or .xz distribution in the FreeBSD-10.1-RELEASE-amd64-disc1.iso\usr\freebsd-dist\ directory.

`# service ftpd start`

On the target machine running iocage...

Assuming that iocage has already been installed on the destination machine, do this:

Change the following in the /usr/local/lib/iocage/ioc-common script file.  Look for the following line:

```
fetch http://${ftphost}${ftpdir}/${file}      -> change http: -> ftp:
```
The basic `iocage fetch`... schema is:
`iocage fetch [release=RLEASE | ftphost=ftp.hostname.org | ftpdir=/dir/]` 
But in my case, the repository resides on my 10.0.0.1 server, so I invoke it like this instead:
`iocage fetch ftphost=10.0.0.1 ftpdir=/`
which connects to the ftpd on the local repository server and points to the chroot dir /home/ftp where the .txz files are located, fetches the ones needed and continues on with the iocage base jail setup.

I know this isn't perfect, but it works.  99.9% of people won't need to do this, but for those who wish to...


----------

