# freebsd-upate on a LAN



## balanga (Apr 17, 2021)

Following guidance from SirDice I've cobbled together instructions on how to run freebsd-update() over a LAN rather than directly obtaining the update over the Internet. This would be particularly useful for anyone on a metered on slow connection. The assumption is that the *Server* has already been updated and the updates are held at /var/cache/freebsd-update/. The *Client* would simply run the usual `freebsd-update -r 13.0-Release upgrade` as normal.

To prepare *Server *(assumes Apache is not installed):-

```
pkg install -y apache24

sed -i '' -e 's/#LoadModule proxy_module/LoadModule proxy_module/
              s/#LoadModule proxy_module/LoadModule proxy_module/
              s/#LoadModule proxy_http_module/LoadModule proxy_http_module/
              s/#LoadModule cache_module/LoadModule cache_module/
              s/#LoadModule cache_disk_module/LoadModule cache_disk_module/' /usr/local/etc/apache24/httpd.conf

cat <<EOF >/usr/local/etc/apache24/Includes/freebsd-update.conf
<VirtualHost *:80>
        ServerAdmin info@example.com
        ServerName fbsd-update.example.com

        ProxyRequests Off
        ProxyPreserveHost Off

        <Proxy *>
          Require all granted
        </Proxy>

        ProxyPass / http://update.freebsd.org/

        <Location />
                ProxyPassReverse /
                Require all granted
        </Location>

        <IfModule cache_module>
                <IfModule cache_disk_module>
                        CacheEnable disk /
                        CacheRoot /var/cache/freebsd-update/
                </IfModule>
        </IfModule>

</VirtualHost>
EOF

sysrc apache24_enable=YES

service apache24 start
```
To prepare *Client *(IP 192.168.1.* should be changed to that of Server):-


```
sed -i '' 's/ServerName update.FreeBSD.org/#ServerName update.FreeBSD.org\nServername fbsd-update.example.com/' /etc/freebsd-update.conf
echo '192.168.1.*  fbsd-update.example.com' >> /etc/hosts
```

Hopefully `freebsd-update -r 13.0-RELEASE upgrade` run on the client will upgrade from the server with needing to access upgrade.freebsd.org.


----------

