FreeBSD 7.x Installation - Part 1

This will be a quick walk through for installation of a FreeBSD 7.x system. The idea is to install a minimal system, recompile the base system with optimizations specific to the architecture, and then install all remaining software from ports (ala Gentoo Linux, except you get a stable BSD system :). This is more of a checklist for future reference and does not replace the FreeBSD Handbook and relevant man pages. Without further adieu…

Installation

Download the latest boot-only iso, md5 checksum the image, and burn to a CD.

ftp://ftp3.freebsd.org/pub/FreeBSD/ISO-IMAGES-i386/

Booting the installation disk, we will follow the standard installation routine. The installation is fairly straight forward; the only hickup for Linux users may be the partition layout. Linux “partitions” are FreeBSD “slices”, where the FreeBSD slice is then divided into “partitions”. An example partition layout:

/          256 MB
/swap      2048 MB
/usr       *
/var       1000 MB

If you are stringent with disk space, feel free to ignore the /var partition. It will install under /root and over time you can move large /var/* directories to /usr and symbolically link them back to /var/.

Install the MINIMAL set and avoid installing the ports tree. Reboot the computer, you now have a minimal FreeBSD installation.

Install your favorite shell. You’re going to be here a while, why suffer?

# pkg_add -r zsh
# chsh

Base System

I like to keep all my locally modified files under a separate directory for easy reference and backup.

# mkdir /root/local
# export LOCALROOT="/root/local/"
# mkdir $LOCALROOT/etc
# mkdir $LOCALROOT/etc/cvsup
# cp /usr/share/examples/cvsup/stable-supfile $LOCALROOT/etc/cvsup/
# vi $LOCALROOT/etc/cvsup/stable-supfile
    >> *default host=ftp4.freebsd.org

Tune the make.conf to your system settings.

# cp /usr/share/examples/etc/make.conf $LOCALROOT/etc/
# ln -s $LOCALROOT/etc/make.conf /etc/
# vi /etc/make.conf
    >> cputype=pentium4m
    >> cflags= -O2 -fno-strict-aliasing -pipe
    >> coptflags= -O -pipe

Configure the kernel for the system. Anyone who has had to recompile the Linux kernel will find the FreeBSD process a real treat. It is common practice to use the hostname (all caps), in this example DALI, as the kernel config file.

# cd /usr/src
# csup /usr/local/etc/cvsup/stable-supfile
# mkdir /root/kernels
# cp /usr/src/sys/i386/conf/GENERIC /root/kernels/DALI
# ln -s /root/kernels/DALI /usr/src/sys/i386/conf/
# vi /root/kernels/DALI

See the FreeBSD handbook for kernel configuration options. Now we can build and install the kernel and base system.

# make buildworld
# make buildkernel KERNCONF=DALI
# make installkernel KERNCONF=DALI
# reboot

# mergemaster -p
# make installworld
# mergemaster -iU
# reboot

Ports

Now we will install the ports tree…

 # portsnap fetch
 # portsnap extract

… and some essential tools.

 # cd /usr/ports/ports-mgmt/portaudit
 # make install clean
 # rehash
 # portaudit -Fda
 # cd /usr/ports/ports-mgmt/portmaster
 # make install clean
 # rehash

Use portmaster -d pkg_name to install any additional ports. As usual, see the manpage for more info.

You now have a FreeBSD 7.x compiled and tuned for your architecture. In Part 2 we will install various ports found on common desktop systems so you can actually get some work done.

i found this very helpful, thanks.