From Chaos
| This article is part of the HOWTO series.
|
Summary
This is a simple How-To in regards to how to do a 'make buildworld' for FreeBSD 5.x. I take no responsibility if you break your system because of this howto. This is NOT a complete, factual representation of how to do this; there are a billion different ways. Take this as one of many examples. And as usual, refer to the FreeBSD handbook.
Caveats
Please note that I do this in multi-user mode. This is definately not recommended, and should be done with caution (especially on production servers!). I also typically use a program called 'screen' to run all the following commands from. This way, I can detach myself from the screen session, and go about other things (it's also a big help if your internet connection dies).
Getting Ready
1. Using 'script' is an excellent way to keep a running log of your console session. Make sure to put it on a partition that has at least 50-100MB of free space; the file can get quite big during the buildworld. Run the following:
| root@localhost:~# script -t 0 /root/buildworld.`date +%m-%d-%Y_%H%M%S`.log
|
2. Now, remove /usr/obj/*:
| root@localhost:~# rm -rf /usr/obj/*
|
Update Source
1. Locate your supfile (standard-supfile if you are running 5.x), and copy it to /root. Edit it, and then cvsup the source (WARNING: This process is usually pretty lengthy, depending on CPU speed, RAM, and Internet connection speed. If you run "cvsup -g -L 2 /root/standard-supfile" and get "command not found" you can do "pkg_add -r cvsup-without-gui && rehash" which will install the cvsup program on your system via the package):
| root@localhost:~# cp /usr/share/examples/cvsup/standard-supfile /root
|
| root@localhost:~# vi /root/standard-supfile
|
2. If you don't know what to make 'CHANGE_THIS' in the supfile, here's a quick and dirty way to see what server is your best ping (of course, you can also install fastest-cvsup from /usr/ports, but I like my method).
| root@localhost:~# perl -e 'foreach (1..15) { print qq{\n\n\ncvsup$_.freebsd.org\n}; system("ping -c 3 cvsup$_.freebsd.org"); }'
|
3. Now, once you figure out which cvsup server to use, save & exit the cvsup file, and run the following. This will take a while:
| root@localhost:~# cvsup -g -L 2 /root/standard-supfile
|
Build World/Kernel
1. Now, run the following. It does pretty much everything you need. First we 'cd' to the right dir, 'date > time.txt' & 'date >> time.txt' gives us a relative time for how long it takes to run (most) everything. Then we clean the world, build it, build the kernel and install the kernel. 'exit' kills the previous 'script' command from above. Once this is completed, you need to reboot your system into single-user mode if you're paranoid, multi-user if you have a death wish:
| root@localhost:~# cd /usr/src && date > time.txt && make clean && make buildworld && make includes && make buildkernel KERNCONF=GENERIC && make installkernel KERNCONF=GENERIC && date >> time.txt
|
| root@localhost:~# shutdown -r now
|
The buildworld one-liner
- I've included this for ease-of-use. Just copy+paste into your terminal, and you should be good-to-go. This should be done after the script command to log the session DONT FORGET TO RECOMPILE YOUR KERNEL WITH QUOTA SUPPORT!!!:
| root@localhost:~# rm -rf /usr/obj/* && cvsup -g -L 2 /root/standard-supfile && cd /usr/src && date > time.txt && make clean && make cleandir && make buildworld && make includes && make buildkernel KERNCONF=GENERIC && make installkernel KERNCONF=GENERIC && date >> time.txt && exit
|
Install the World and Merge it
Do the following at your own risk! More often than not, I've broken things and/or encountered errors doing the following. 'script' helps us log everything incase something does go haywire.
WARNING
| This is not the correct procedure if you are doing a major version upgrade (5.x -> 6.x). You should also probably do this in single-user mode, YMMV.
|
| root@localhost:~# script -t 0 /root/installworld.`date +%m-%d-%Y_%H%M%S`.log
|
| root@localhost:~# cd /usr/src && make installworld && mergemaster -vai
|
| root@localhost:~# shutdown -r now
|
Done! Enjoy your newly updated system!