guinix international

Computing Without Borders

 

guinix TechNote: FreeBSD Without the Burn

Network installation with ISO image files

Introduction

A number of methods may be used to install FreeBSD. The most convenient of these is with a bootable CD-ROM. Vendors such as FreeBSD Mall make available regular publication of CD-ROM sets, and subscribers get these automatically about 3 times/year at very reasonable cost.

FreeBSD Mall also turns a portion of its sales proceeds back to the FreeBSD project, so subscriptions are a great way to support the project, stay current, and have a convenient, complete repository of FreeBSD software and documentation.

Alternatively, FreeBSD makes ISO images of its distributions freely available for download. If one has a CD-RW device (and the bandwidth to snag the files in the first place), these ISOs may in turn be burned onto CD media and used for installation on any machine with a CD-ROM drive.

Yet for local network installations on multiple hosts, there is still another way to conveniently install from these ISO images, without burning them onto CD, without even the need for CD-ROM hardware of any kind. Instead, the images files may themselves be mounted directly on the filesystem of a FreeBSD "ISO server", and installed via FTP from any host on the local network.

This TechNote describes one way to do this. But first, why would you want to?

The Latest and Greatest: FreeBSD 5.0

Recently the FreeBSD project released its first distribution in the 5.x series, FreeBSD 5.0. This distribution represents an important milestone for the project, and includes many important new technologies.

I was eager to get this distribution as soon as possible. Even though I am a FreeBSD Mall subscriber, I knew it would be a few weeks before I would get the CD-ROM set in the mail. For this release, I just didn't want to wait!

One method of installation is to make a pair of boot floppies, start the installation program, and then FTP the rest of the install over the Internet. I did this for one of our servers, and a good broadband DSL connection actually makes this a workable method.

After only a couple days, though, I was liking 5.0 a lot, and wanted to get it going on more of our systems. But it seemed kindof a waste of bandwidth to repeat the FTP install process over the Internet for each system. Could I make use of the ISO images somehow, even though we don't have a CD-ROM burner?

How To

Step 1. First, download an ISO image file from FreeBSD or mirror into a useful location on what will be your "ISO server" host. For example:

  # mkdir -p /usr/local/distiso
  # cd /usr/local/distiso
  # ftp://ftp.FreeBSD.org/pub/FreeBSD/ISO-IMAGES-i386/5.0/5.0-RELEASE-i386-miniinst.iso

This file is about 220 megabytes, and includes the base installation, documentation, source code, and ports tree. This ISO does not include a packages directory, though, as you may be used to finding on disk 1 of a distribution set. If you've just gotta have the full disk 1, another ISO image is available in 5.0-RELEASE-i386-disc1.iso, at a size of over 575mb. The full ISO may be preferable if you are installing several large packages, such as XFree86, on multiple systems. Pick one ISO or the other, though; you don't need both.

Step 2. Next, configure the ISO as a "memory disk" and mount it on the filesystem:

  # mkdir -p /mnt/iso/5.0-RELEASE
  # mdconfig -a -t vnode -f /usr/local/distiso/5.0-RELEASE-i386-miniinst.iso -u 0
  # mount -t cd9660 /dev/md0 /mnt/iso/5.0-RELEASE

This is the magic! The image file is now mounted and readable just like the CD-ROM would be. Don't believe it? "cd" into /mnt/iso/5.0-RELEASE and have a look around.

Note: the "mdconfig" command is new to FreeBSD 5.0. On FreeBSD 4.x, use the "vnconfig" command instead:

  # vnconfig -c vn0c /usr/local/distiso/5.0-RELEASE-i386-miniinst.iso
  # mount -t cd9660 /dev/vn0c /mnt/iso/5.0-RELEASE

Step 3. Using "vipw", edit /etc/passwd and add an "ftp" user entry like this:

  ftp:*:99:99::0:0:FTP:/mnt/iso:/nonexistent

Step 4. Enable ftp service on this host by: a) editing /etc/inetd.conf and uncommenting the ftp service line; and b) starting (or restarting) "inetd".

(For starting "inetd" on boot, set inetd_enable="YES" in /etc/rc.conf. To restart an inetd already running, give its PID a SIGHUP.)

Step 5. Now this "ISO server" is available for FTP installs from any number of hosts on your local network. Simply start the install on these other hosts with any of:

  • boot floppies
  • boot or rescue cdrom from a compatible distribution (*)
  • existing /stand/sysinstall (*)

[*NOTE: The 5.0-DP (developer preview) release CD-ROMS--such as the FreeBSD Mall Toolkit of December 2002--will work ok to install the system as described above, but do leave behind an older version of /stand/sysinstall on your system. The sysinstall can be upgraded in place on the new installation by building from the installed source, eg, "build world". (This newer 5.0-RELEASE version of sysinstall is necessary for accessing the UFS2 filesystem options while configuring the disklabel during installation.) Also, though I didn't test this, it is probably Not A Good Thing to use 4.x versions of sysinstall for 5.x installations. In any case, it will be necessary to set the "Release Name" variable within the "Options" editor if the sysinstall and release versions don't match. A name of "5.0-RELEASE" will work with the example described above; a name of "any" will force sysinstall to accept installation of any release found on the install media.]

After configuring the slice and disklabel (aka, partitioning), select the installation media as FTP, and enter the URL to the "ISO server" host you set up in steps 1 to 4 above.

Note that if you need to make boot floppies, you don't need to download these separately--they are already included in your ISO image. "cd" into /mnt/iso/5.0-RELEASE/floppies and "dd" the *.flp files you need from there.

Cleaning Up

After installing what you want, unmount and release the ISO memory disk on the "ISO server" host as follows:

  # umount /mnt/iso/5.0-RELEASE
  # mdconfig -d -u 0

The equivalent (and deprecated) on FreeBSD 4.x:

  # umount /mnt/iso/5.0-RELEASE
  # vnconfig -u vn0c

Summary

And there you have it: fast, quiet FreeBSD installations over your local network from CD-ROM images, without whining and totally smoke-free!


Copyright © 2002 - 2005, Wayne Marshall. All rights reserved.
Last edit 2005.03.07, wcm.