blog.up-link.ro android bsd linux unix & open-source world

12Feb/105

FreeBSD: How To Upgrade FreeBSD 7 to 8 Stable Release

WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed or subscribe via E-mail for updates on this topic.

FreeBSD 7.x allows upgrade of existing installation to FreeBSD 8.0-STABLE. Since this is a major version upgrade, it is recommended that you backup your data, database and configuration files.

This guide will walk a user through updating his source to follow FreeBSD's stable branch.  Please make a full backup of the current system before following this guide.

STEP 1: Syncing the source tree

- cvsup installation and configuration

# cd /usr/ports/net/cvsup-without-gui

# make install clean

OR

# pkg_add -r cvsup-without-gui

Copy the sample supfile for Stable to /usr/local/etc/stable-supfile:

# cp /usr/share/examples/cvsup/stable-supfile /usr/local/etc/

Edit file and set host name which specifies the server host which will supply the file updates to your system.

*default host=cvsup1.us.FreeBSD.org

Set release tag to stable 8:

*default release=cvs tag=RELENG_8

Run cvsup to download the latest stable source:

# cvsup -L 2 /usr/local/etc/stable-supfile

When the cvsup has completed, change to the /usr/src directory

# cd /usr/src

and read UPDATING file. This file will contain information that may be needed to properly update the FreeBSD system.

STEP 2: Compiling the source

Tweak your /etc/make.conf before you start the compilation

# vi /etc/make.conf

# The CPUTYPE variable specifies your processor type so that the compiler will produce the optimized binary code for your specific processor.
# A list of supported processors can be found in the /usr/share/examples/etc/make.conf file.
# Currently supported processor optimizations that are available:
#     Intel IA32 : core2, core, Nocona, pentium4m, pentium4, prescott, pentium3m, pentium3, Pentium-m, pentium2
#     Intel IA64 : itanium, itanium2
#     AMD        : opteron, athlon64, athlon-mp, athlon-xp, athlon-4, athlon-tbird, athlon, k8, k6-3, k6-2, k6, k5

CPUTYPE?=core2

# The CFLAGS variable specifies any additional compiler options that you want to pass to the compilers.
# These additional settings mostly deal with the performance of the compiling process or that of the output binary code.
# A typical CFLAGS variable would look like this:  CFLAGS= -O2 -pipe
CFLAGS= -O2 -pipe
COPTFLAGS= -O2 -pipe
CFLAGS+= -O2 -pipe

# Disable debug information
WITHOUT_DEBUG=yes

WITH_CPUFLAGS=yes
WITH_OPTIMIZED_CFLAGS=yes

WITHOUT_X11=YES # if you don't need X
BOOTWAIT=0
NO_INET6=YES # no IPv6

Save the file and exit vi.

Tip: An updated list of supported processors can be found in the /usr/share/examples/etc/make.conf file.

Compiling the source (buildworld)

# cd /usr/src

# make buildworld

Building the kernel (buildkernel)

To create a custom configuration, go to /usr/src/sys/i386/conf and make a copy of the GENERIC file, name it something like MYOWNKERNEL. Edit your configuration and proceed with buildkernel.

Note: To add SMP, QUOTA, ALTQ and PF support in kernel, add the following lines to MYOWNKERNEL:

# To make an SMP kernel, the next two lines are needed
options SMP                   # Symmetric MultiProcessor Kernel
device apic                     # I/O APIC

options QUOTA                   # Enable disk quotas

device pf                       # PF support
device pflog                    # PFlog support
device pfsync                   # PFsync support

options ALTQ                    # ALTQ support
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
options ALTQ_PRIQ               # Priority Queuing (PRIQ)
options ALTQ_NOPCC              # Required for SMP build

Next, proceed with buildkernel:

# make buildkernel KERNCONF=MYOWNKERNEL

STEP 3: Installing the new kernel

Boot to single-user mode. This is important because replacing system files while in use in a running system is not a good idea (anyway, installing the kernel and world in single-user mode is not required. It's only the safest method).

# reboot

Once in single-user mode , run the following commands:

# fsck -p

# mount -u /

# mount -a -t ufs

# swapon -a

# cd /usr/src

# make installkernel KERNCONF=MYOWNKERNEL

Note: To boot in the single-user mode you have to select option 4 from boot menu.

Now, you have to reboot

# reboot

STEP 4: Installing the world (installworld)

Once in single-user mode, run the following commands:

# fsck -p

# mount -u /

# mount -a -t ufs

# swapon -a

# cd /usr/src

# mergemaster -p

mergemaster is used to compare only those files that are essential for the cussess of buildworld or installworld.

Select No when prompted to remove /var/tmp/temproot.

Now, type the following command:

# make installworld

Now, run mergemaster to compare all the configuration files

# mergemaster

Note: Unfortunately the mergemaster is the most complex and the least amount of help is provided.  Understanding how mergemaster works will help.  It compares the configuration files in use on the current system with the new configuration files from the newly compiles source.  It uses diff to display both files at the same time.  Lines that are new and will be added if the new configuration file is installed have a plus (+) sign by them.  Lines that will be removed from the configuration file if you install the new one have a minus (-) sign by them.  One tip is that if the changes are only to comment lines (comment lines begin with a pound (#) sign) it is usually safe to install the new configuration file.  Another tip is that if there is a minus (-) sign next to something that needs to be kept, do not install the new file but either leave the file to be dealt with manually or merge the two files.

Note: It is common to run mergemaster multiple times.

Reboot the system.

Once the reboot has completed, the system should boot the stable release. It's a good idea to update the ports tree after rebuilding from source:

# portsnap fetch update

# portupgrade -aiRry

That's all.

Print This Post Print This Post
Comments (5) Trackbacks (0)
  1. nice tutorial, keep up the good job!

  2. Can this upgrade be done over SSH, or will there be issues with the system after the reboot?

  3. rtreny :

    Can this upgrade be done over SSH, or will there be issues with the system after the reboot?

    It’s working over SSH without problems, just skip boot in single mode steps.

  4. upgraded from 7.2 to 8.0 via ssh without any problems. everything works as expected.

  5. That is really interesting!
    I have joined your network and look forward for new posts.
    Additionally, I have shared your website in my social networks.


Leave a comment


*

No trackbacks yet.