posted by Nathan Mace on Tue 19th Mar 2002 17:21 UTC
IconMost tech savvy geeks can work their way through a FreeBSD install, even if they have no prior UNIX experience. However installing an OS and configuring an OS are two totally different things. This article is targeted towards anyone who might be wondering about FreeBSD, but doesn't know what to do with it after they install it. This isn't then end-all be-all of FreeBSD howto's. Just some of the simple stuff. Update: Some of the readers of OSNews have emailed me concerning corrections that need to be made in this article. Dig in (third page) for more.

CVSup

So you've taken the first step and installed FreeBSD. Now you're wondering what to do with this new operating system. Unlike some of the bigger Linux distributions, FreeBSD gives you a basic install, and leaves it upto you to add in what you want. Lets say that you want to set up this box as a SMB file server for your network. To do that we will need to install Samba. This seems like the perfect time to see that "ports tree" that youkeep hearing so much about in action. The first thing we need to do is install the cvsup package. Cvsup is a utility that reads a conf file, known as a 'sup-file' that tells it what server to use, and what to download. In essencewhat it does is it compares your local copy of the ports tree to the copy of the ports tree on the cvsup server. It then downloads everything in the ports tree that is newer than what is on your machine. The easiest way of installing cvsup is with the pkg_add command. All you have to do is login in as root, and type "pkg_add -r cvsup" and it will automatically download the cvsup package from a FreeBSD server and install it. You can also find on the CD under the /cdrom/Packages/All directory. Now that it is installed, we need to create our custom sup-file. The templates are located in the /usr/share/examples/cvsup directory. We want to copy the ports-supfile someplace where we won't loose it. I prefer the /root directory, but copy it wherever you want to. Next we need toedit the file, so open it up in your editor of choice. Note that unless you choose to install your favorite editor during the install you might have to get by with vi for now. First we have to change the cvsup host server, so we go over to freebsd.org and consult the handbook.

After you locate a cvsup server closest to you, change the "CHANGE_THIS.freebsd.org" to whatever server is closest to you. Now we need to set up which collections we want to download whenever we run cvsup. The ports tree is divided into several sections such as ports-cad, ports-german, etc, etc. By default the sup-file uses the ports-all collection, which is all of the collections. Since I don't know any language besides English, I commented out all of the foreign language collections. NOTE: If you do comment out any of the collections, be sure that you DO comment out the ports-all entry and that you DO NOT accidentally comment out the ports-base entry. Nothing horribly bad will happen if you do other than you will have to cvsup the ports tree again. After you have edited the file, run the command "cvsup ports-supfile". You should see lots of messages fly by as the ports tree is updated. The time it takes to update depends on two things, the speed of your 'Net connection, and how long ago you last updated. Depending on how long ago you downloaded the ISO image of the -RELEASE CD it could be pretty outdated, so it could take awhile for the process to complete. In my opinion it is better to answer "Yes" during the install when it asks you if you want to install the ports tree from CDROM. Even though it might be out of date, some of the ports will still be current, which will save you time and bandwidth when you first cvsup.

Mounting CDROM's

One of the first things I had to do when I first installed FreeBSD was mount my CDROM so that I could install cvsup. I didn't know about the -r flag yet, but even if you don't need it for a package, you will probably need to read a CDROM sooner or later. All you have to do is find the device name of your CDROM(look in dmesg | more). After you find that open your /etc/fstab file and add a new line that consists of /dev/xxx /cdrom cd9660 ro,noauto 0 0 where /dev/xxx is whatever device your CDROM is. After that you have to type "mount /cdrom" and then you can access the contents of the CDROM under the /cdrom directory. If for some reason you don't have a /cdrom directory, just type "mkdir /cdrom". Also, by default you have to be root to mount filesystems, that includes CDROM's.

Init

The various Linux distro's(except for slackware) use the sysinitV style of rc files to determine what gets started at boot up. FreeBSD on the other hand uses a bsd-style init system. Essentially all you have to do to start something at boot time it to write a shell script that starts the program, make the script executable, put a .sh ending on it and place it in the /usr/local/etc/rc.d directory. Note that it is a requirement that the script ends with .sh. Also note that the /etc directory has several rc.* files, but not a rc.d directory. That's because by convention you should place your startup scripts in the /usr/local/etc/rc.d directory, in fact you'll notice that almost anything installed via ports or packages, and for the most part compiled by hand will either install by default in /usr/local/ or /usr/X11R6 instead of /opt and /usr.

Table of contents
  1. "CVSup, Mounting CDROMs, Init"
  2. "The Ports System, Part I"
  3. "The Ports System, Part II"
e p (0)    25 Comment(s)

Technology White Papers

See More