Sunday, April 29, 2012

HowTo: Upgrade FreeBSD 7.2 To FreeBSD 8 Using csup

How do I upgrade FreeBSD 7.2 to FreeBSD 8 stable using csup source code method including all ports?


Make a copy of existing supfile, enter:
# cp /usr/share/examples/cvsup/standard-supfile /root/supfile.8
# vi /root/supfile.8

Set host name which specifies the server host which will supply the file updates to your computer. You must set it to one of the CVSup mirror sites listed in the FreeBSD page
*default host=cvsup1.us.FreeBSD.org
Set release tag to stable 8:
*default release=cvs tag=RELENG_8_0
Save and close the file.

Step # 2: Grab FreeBSD 8 Base System

Type the following command:
# csup /root/supfile.8
Read all last minute updating information for FreeBSD 8, enter:
# vi /usr/src/UPDATING

Step # 3: Build FreeBSD 8 Base System

You can enable or disable certain features such as NIS, ATM, BLUETOOTH and much more (see src.conf(5) man page). Edit /etc/src.conf and disable required features from base system:
WITHOUT_ATM=yes
WITHOUT_CALENDAR=yes
WITHOUT_GAMES=yes
WITHOUT_I4B=yes
WITHOUT_IPFILTER=yes
WITHOUT_IPX=yes
WITHOUT_LPR=yes
WITHOUT_NETCAT=yes
WITHOUT_NIS=yes
WITHOUT_RCMDS=yes
WITHOUT_SENDMAIL=yes
WITHOUT_WPA_SUPPLICANT_EAPOL=yes
WITHOUT_ZFS=yes
WITHOUT_BLUETOOTH=yes
Note you can skip /etc/src.conf and build the entire system. To build FreeBSD 8 system, enter:
# cd /usr/src
# make cleanworld && make cleandir
# make buildworld

Step # 4: Build FreeBSD 8 Kernel

You need to edit your kernel config file which is located at /usr/src/sys/`uname -p`/conf, enter:
# cd /usr/src/sys/`uname -p`/conf
# ls -l

The default file name is GENERIC. Edit GENERIC or your own custom kernel file (e.g., NIXCRAFT), enter:
# vi GENERIC
OR
# vi NIXCRAFT
My sample kernel config file:
include GENERIC
ident www303
options SMP
nodevice ugen
nodevice uhid
nodevice ulpt
nodevice umass
nodevice ums
nodevice ural
nodevice urio
nodevice uscanner
nodevice aue
nodevice axe
nodevice cdce
nodevice cue
nodevice kue
nodevice rue
options CONSPEED=19200
options QUOTA
# pf firewall specific
device pf
device pflog
device pfsync
options ALTQ
options ALTQ_CBQ # Class Bases Queuing (CBQ)
options ALTQ_RED # Random Early Detection (RED)
options ALTQ_RIO # RED In/Out
options ALTQ_HFSC # Hierarchical Packet Scheduler (HFSC)
options ALTQ_PRIQ # Priority Queuing (PRIQ)
options ALTQ_NOPCC # Required for SMP build
# Turn on device polling for em driver
options DEVICE_POLLING
options HZ=1000
Make changes as per your setup. Finally, build and install the FreeBSD 8 kernel, run:
# make buildkernel
# make installkernel

OR use your custom kernel config name (e.g., NIXCRAFT), run:
# make buildkernel KERNCONF=NIXCRAFT
# make installkernel KERNCONF=NIXCRAFT

Step # 5: Reboot And Boot Into A Single User Mode

To reboot the system, enter:
# reboot
To boot into a single user hit 4 key at boot loader prompt:
Fig.01: FreeBSD Boot Loader Menu
Fig.01: FreeBSD Boot Loader Menu

A Note About Remote FreeBSD Server Using KVM

You need to boot into a single user mode using KVM to finish entire upgrade procedure. KVM will not work in a single user mode. However, you can load usb.ko and other modules to get kvm support under single user mode. Press [Enter] key at the boot loader. Connect to your remote FreeBSD box using KVM client and issue reboot command. At FreeBSD boot menu press [Spacebar] key to pause default booting. Press 6 to boot to loader prompt. Type the following commands to load KVM support and boot into a single user mode:
load usb.ko
set boot_serial=NO
set boot_multicons=NO
set console=vidconsole
boot -s
Once logged into a single user mode, mount all your ufs partitions, enter:
# mount -a -t ufs

Step # 6: Merge Configuration Files

The mergemaster utility is designed to aid you in updating the various configuration and other files associated with FreeBSD. To install sys configuration files that are required by the new base system. To compare only files known to be essential to the success of install world, enter:
# mergemaster -p

Step # 7: Install FreeBSD 8 Base System

Type the following commands:
# cd /usr/src
# make installworld

Finally merge your configuration files, enter:
# mergemaster -i
WARNING! Be careful with /etc/passwd, /etc/group and other files in base system. Verify each file before installing new version or merging exiting configuration files.
Finally, reboot the box:
# reboot

Step # 8: Verify New Installation

Type the following command:
# uname -a
# tail -f /var/log/messages
# grep 'something' /path/to/log/file

Step # 9: Upgrade Ports (Applications)

Type the following command:
# portsnap fetch update
# vi /usr/ports/UPDATING
# portmaster -Da

Reboot the box again and make sure everything is working fine, enter:
# reboot
Finally, delete old libraries, enter:
# cd /usr/src
# make delete-old

No comments:

Post a Comment