# Build Your Own FreeBSD Update Server



## jgh@ (Feb 23, 2011)

This is a howto that I wrote that was recently committed to the FreeBSD Documentation Project.

http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server


----------



## nestux (Feb 24, 2011)

Very useful, thanks you.


----------



## fadolf (Mar 2, 2011)

Very useful indeed. The only thing that remains a bit unclear is where one would make customisations to the kernel, or rather if those would have to be made to the GENERIC configuration or by adding a custom one and setting KERNELPARTS to that target?

Thanks in advance for clarifying.


----------



## copypaiste (Mar 4, 2011)

Is there any way to avoid downloading during initial build run? I'd like to use already fetched iso image.


----------



## copypaiste (Mar 4, 2011)

Also it seems that scripts/init.sh using old naming scheme when fetching iso images, so it fails when I tried to run initial build for 8.1-RELEASE:


```
>./scripts/init.sh i386 8.1-RELEASE
Fri Mar  4 11:47:53 MSK 2011 Starting fetch for FreeBSD/i386 8.1-RELEASE
fetch: ftp://ftp4.ru.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.1/8.1-RELEASE-i386-disc1.iso: Not Found
```

But:

```
> fetch -s 'ftp://ftp4.ru.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/8.1/FreeBSD-8.1-RELEASE-i386-disc1.iso'
676384768
```


----------



## fadolf (Mar 4, 2011)

Yeah i noticed that too. You need to make these changes to scripts/build.subr.


```
--- scripts/build.subr.orig	2011-03-04 11:09:38.000000000 +0100
+++ scripts/build.subr	2011-02-14 15:10:33.000000000 +0100
@@ -301,7 +301,7 @@
 
 	# Figure out where the disc1 ISO image is
 	RELNUM=${REL%-*}
-	ISO=${FTP}/${TARGET}/ISO-IMAGES/${RELNUM}/${REL}-${TARGET}-disc1.iso
+	ISO=${FTP}/${TARGET}/ISO-IMAGES/${RELNUM}/FreeBSD-${REL}-${TARGET}-disc1.iso
 
 	# Fetch the ISO image.  We consider the ISO image to be
 	# the One True Release and don't look at the files used
```


----------



## copypaiste (Mar 4, 2011)

Thanks, I see now it would be easy to modify the procedure and make it check the iso image before trying to fetch anything.


----------



## jgh@ (Mar 6, 2011)

fadolf said:
			
		

> Very useful indeed. The only thing that remains a bit unclear is where one would make customisations to the kernel, or rather if those would have to be made to the GENERIC configuration or by adding a custom one and setting KERNELPARTS to that target?
> 
> Thanks in advance for clarifying.



You would need to modify the actual release to include a new kernel, or modify GENERIC. If you add a new kernel, you would need to alter KERNELPARTS for your additional kernel support, and be aware of it in the jail creation, as well. If you just patch GENERIC, you would not need to do anything else. It literally could be a 0 level patch to the distribution.


----------



## jgh@ (Mar 6, 2011)

copypaiste said:
			
		

> Is there any way to avoid downloading during initial build run? I'd like to use already fetched iso image.



You just need to modify the fetchiso location you are downloading from in build.subr. You could simply create an anonymous ftp server locally, even.


----------



## jgh@ (Mar 6, 2011)

fadolf said:
			
		

> Yeah i noticed that too. You need to make these changes to scripts/build.subr.
> 
> 
> ```
> ...



Yes, this is due to recent updates to the naming of the iso when built. fetchiso routine can be modified on a per release basis in build.subr under the scripts/architecture/x.x-RELEASE/ to account for differences in 7.x and 8.x releases


----------



## jgh@ (Mar 6, 2011)

In about the past week or so, I have updated the article. One was a formatting update, and the other was a content update. The content update fixed some redundancy, provided some clarity and I also expanded on the tips, which may help with some of the updates I posted in this thread.

http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/tips.html


----------



## fender0107401 (Apr 6, 2011)

Good job!

Your have contributed!


----------



## silverglade00 (Jan 20, 2012)

*9.0-release*

I am currently in the process of trying to get updates for 9.0-RELEASE built. A lot has changed in the layout of the .iso file. If anyone is interested, I would be happy to collaborate. I can get pretty much everything except the kernel built correctly.


----------



## jgh@ (Jan 21, 2012)

cperciva has committed recently to the project that should help in your effort:
http://www.freebsd.org/cgi/cvsweb.cgi/projects/freebsd-update-server/scripts/9.0-RC2/


----------



## silverglade00 (Jan 24, 2012)

Thanks, jgh! I will start testing it and report back.


----------



## silverglade00 (Feb 28, 2012)

Wow, I was really horrible about reporting back. It worked great. We are now in production serving up FreeBSD 9.0-RELEASE via freebsd-update on our internal network.


----------



## Jubakka (Nov 21, 2013)

Hi all. I am new to FreeBSD and want to use a server to upgrade the internal network, just like @silverglade00. I just don't know how to reconfigure the build.subr for 9.1 or 9.2. I used http://www.freebsd.org/doc/de/articles/freebsd-update-server/build.html as a reference, but it doesn't work. It starts getting weird with `sh scriÃ¼ts/init.sh amd64 9.1-RELEASE`. Is there any new documentation about it? Thanks a lot.

Greetings


----------



## cforger (Dec 23, 2013)

Hello,

 Yes, it's still broken with a fresh 9.2-RELEASE. I've figured out about the FTP site format, but the new ISO format is a problem and I haven't made it past that yet. I haven't built a working freebsd-update server before, so it's tricky to change so much when I don't even know if I'm following the instructions properly.  

Note: I notice that my build.subr has the proper ISO= format (both lines really, the second line overloading the first), so that doesn't need changing. 

This looks to be the most up to date thread, and if the link above (http://www.freebsd.org/cgi/cvsweb.cgi/p ... ate-server) would work, it may answer my questions.

If anyone else has made progress,let me know - I'm going to see where I can get with it today.


----------



## Jubakka (Jan 7, 2014)

This link (http://www.freebsd.org/cgi/cvsweb.cgi/p ... ate-server)  is unfortunately down. But I am still trying to get it to work on 9.2.  I get errors after the SSH login with my tar process and it aborts. Is there an option to do the upload on my local server without a SSH connection? 

I'll continue trying.


----------



## jgh@ (Mar 24, 2016)

silverglade00 said:


> Wow, I was really horrible about reporting back. It worked great. We are now in production serving up FreeBSD 9.0-RELEASE via freebsd-update on our internal network.



Great, thanks. I'm glad the article helped you. Currently, I am trying to verify the article for 10.2, but am not able to get a build without errors. Are you still running this process successfully? I would love to see your notes on how you were able to get this to build properly. Please share.

Thanks!
-jgh


----------



## zirias@ (May 25, 2018)

I'm still a bit confused here. What I would like to do is enable `freebsd-update` in my network to fetch from my own server and have a version there that's built with some /etc/src.conf options. For building, I have checked out /usr/src from the RELENG branch for 11.1.

Now, looking at this, it seems freebsd-update-server does a build itself and always wants the base release version plus all patches separately? Is there an easier way?


----------

