2008年6月8日 星期日

How To Upgrade FreeBSD 6.2 to FreeBSD 6.3 ( Minor Update ) using freebsd-update utility

Q. I've FreeBSD 6.2 p9 installed and I'd like to upgrade my box to latest FreeBSD 6.3 release using binary update method. How do I upgrade my box over an ssh session?



A. FreeBSD 6.3 has new updated tool called freebsd-update which supports binary upgrades of i386 and amd64 systems systems running earlier FreeBSD releases, release candidates, and betas. Users upgrading to FreeBSD 6.3 from older releases (in particular, older than 6.3-RC1) will need to download an updated version of freebsd-update(8) that supports upgrading to a new release.


WARNING! These examples may crash your FreeBSD computer if executed or interrupted over ssh session. Backup both data and configuration file before attempting these instructions.

Step # 1: Find out current FreeBSD version


$ uname -mrs

Output:


FreeBSD 6.2-RELEASE-p9 i386

Step # 2: Download updated freebsd-update


Download an updated version of freebsd-update utility that supports upgrading to a new release.


Download freebsd-update-upgrade package:

# fetch http://people.freebsd.org/~cperciva/freebsd-update-upgrade.tgz

Download gpg key to verify package:

# fetch http://people.freebsd.org/~cperciva/freebsd-update-upgrade.tgz.asc

Verify package:

# gpg --verify freebsd-update-upgrade.tgz.asc freebsd-update-upgrade.tgz

Extract package:

# tar -xf freebsd-update-upgrade.tgz


Step #3: Start update procedure with freebsd-update


Start upgrade procedure and download all lates files / packages, enter:

# sh freebsd-update.sh -f freebsd-update.conf -r 6.3-RELEASE upgrade

Output:


Looking up update.FreeBSD.org mirrors... 1 mirrors found.
Fetching metadata signature for 6.2-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system...
The following components of FreeBSD seem to be installed:
kernel/generic world/base world/dict world/doc world/manpages

The following components of FreeBSD do not seem to be installed:
kernel/smp src/base src/bin src/contrib src/crypto src/etc src/games
src/gnu src/include src/krb5 src/lib src/libexec src/release src/rescue
src/sbin src/secure src/share src/sys src/tools src/ubin src/usbin
world/catpages world/games world/info world/proflibs

Does this look reasonable (y/n)? y

Fetching metadata signature for 6.3-RELEASE from update1.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system...
done.
Preparing to download files... done.
Fetching 6150 patches.....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150....160....170....180....190....200....210....220....230....240....250....260....270....280....290....300....310....320....330....340....350....360....370....380....390....400....410....420....430....440....450....460....470....480....490....500....510....520....530....540....550....560....570....580....590....600....610....620....630....640....650....660....670....680....690....700....710....720....730....740....750....760....770....780....790....800....810....820....830....840....850....860....870....880....890....900....910....920....930....940....950....960....970....980....990....1000....1010....1020....1030....1040....1050....1060....1070....1080....1090....1100....1110....1120....1130....1140....1150....1160....1170....1180....1190....1200....1210....1220....
.......
..
....
/bin/rcp
/bin/realpath
/bin/red
/bin/rm
/bin/rmail
/bin/rmdir
/bin/setfacl
/bin/sh

Install downloaded files:

# sh freebsd-update.sh -f freebsd-update.conf install

Output:


Installing updates...
Kernel updates have been installed. Please reboot and run
"freebsd-update.sh install" again to finish installing updates.

Reboot the box:

# reboot


Step #4: Install userland updates


You also need to upgrade other userland packages:

# sh freebsd-update.sh -f freebsd-update.conf install

Output:


Installing updates...

Again reboot the box, enter:

# reboot


Step #5: Verify updates


Make sure there are no error reported on console or log files:

$ uname -mrs

Output:


FreeBSD 6.3-RELEASE i386

Step #6: Update applications / port tree


Finally, you may need to upgrade running application such as php, apache, openssh and others. Simply use portsnap and portmanager commands to update all installed packages:

# portsnap fetch extract

# pkg_version -vIL=


Now upgrade installed ports:

# portmanager -u

OR

# portupgrade -a


References:


upgrade to 7.0

比較要注意的是 default thread library 從 libpthread 換成 libthr ,所以要記得重編一些 ports (簡單的方式就是把 /lib/libpthread.so.2 砍掉,然後會叫的 ports 就是要重練的)。其實去 ls /lib 下可以看到有些過期的,應該也要一併移除,減少 ldconfig 的負擔

How To Upgrade FreeBSD 6.3 to 7.0 Stable Release

A. FreeBSD 6.3 allows upgrade of existing installation to FreeBSD 7.0-RELEASE. Since this is a major version upgrade, it is recommended that you backup existing data, database and config files. You also need to reinstall all ports.


Step # 1: Upgrade ports


Type the following command, enter:

# portupgrade -faP


WARNING! This procedure might not work for you as upgrading system is complex procedure. This may result into data loos. Please backup all important data and configuration files before executing any commands. All instructions are tested on FreeBSD 6.3pX 32/64 bit computers.

Step # 2: Download updated freebsd-update-upgrade tool


Type the following command:

# fetch http://people.freebsd.org/~cperciva/freebsd-update-upgrade.tgz

# fetch http://people.freebsd.org/~cperciva/freebsd-update-upgrade.tgz.asc

# gpg --verify freebsd-update-upgrade.tgz.asc freebsd-update-upgrade.tgz

# tar -xf freebsd-update-upgrade.tgz


Step # 3: Start upgrade procedure


Type the following command to install new kernel and reboot the system, enter:

# sh freebsd-update.sh -f freebsd-update.conf -r 7.0-RELEASE upgrade

# sh freebsd-update.sh -f freebsd-update.conf install

# reboot


Step # 4: Install updated userland tools


Install the new userland components, after which all ports should be recompiled to link to new libraries:

# sh freebsd-update.sh -f freebsd-update.conf install

# portupgrade -faP


Step # 5: Remove all old libraries


Finally, freebsd-update.sh needs to be run one last time to remove old system libraries, after which the system should be rebooted in order that the updated userland and ports will be running:

# sh freebsd-update.sh -f freebsd-update.conf install

# reboot


Step # 6: Verify FreeBSD 7.0


Run following command to verify that everything is running smoothly, enter:

# uname -a

# tail -f /var/log/messages

# tail -f /path/to/other/log/files

# egrep -i 'errorwarning' /path/to/log/files

# sockstat -4 -l


References: