Documents >> FreeBSD >> FreeBSD Base Install

FreeBSD Documents

FreeBSD Base Install
FreeBSD 7.0 Install
FreeBSD Postfix Guide
FreeBSD Maildrop filter
SQLGrey Greylist on Postfix
FreeBSD Login Graphic
FreeBSD Migrate Users
Uptimize FreeBSD as Guest

Frebsd 7.0 base install steps

Well. I have been missing the base install steps for some time now, but lucky me, one of my good friends ( made one and decided to share it with me.

The FreeBSD installer looks a bit like the Debian or Ubuntu alternate ones. I’m going to go with a standard installation. Let me say this at once: I think I’ll try the installation process a few time so I’ll get to know it, avoid mistakes when moving to a production environment, view additional configuration parameters, and first afterwards start playing with the system. Well, as said: I chose standard installation.

When I came to choosing distributions, I only chose the minimal-distribution. I think that’s the most suitable for a server - I want control of the components on the server, so I’ll install the necessary ones manually after the installation.

I think this is the time for a short sidekick. Whereas Debian/Ubuntu has it’s main focus on precompiled packages (.debs), FreeBSD has it’s focus on so-called ports. It’s just bare naked source code (including Makefiles etc.). To install a port, the first thing the operating system does is to compile the program and afterwards copy all the files to the right places. This means that I’ll the programs get customized for precisely your system, but it takes some extra time to perform installation of application. I might say this now: FreeBSD also offers packages (as opposed to ports) that’s precomiled binaries one can use. Well, I like the idea of ports - and the compilation time won’t be a problem for be because I’m not going to compile Gnome or similar: I think Apache, PHP, MySQL, Postfix, Courier, and a couple of other would do. So I’m definitely going for ports. If you hoped for packages, I’m sorry - please use your preferred search engine to find something about that. One of the thinks I’m really exited to see, is how well and easy the process of updating installed ports is. It’s not required to be apt-get upgrade-easy, but something like it would be top notch!

Well, let’s continue with the installation! I chose to install from the CD. Normally I’d install from FTP so get the newest version at once, but I’d really like to review the update/upgrade process of FreeBSD et al., so I’ll pick the CD this time.

At a time you have to decide whether to enable “Linux Binary Compatibility”. To quote from [2]:

At this point, you may be asking yourself why exactly, does FreeBSD need to be able to run Linux binaries? The answer to that question is quite simple. Many companies and developers develop only for Linux, since it is the latest “hot thing” in the computing world. That leaves the rest of us FreeBSD users bugging these same companies and developers to put out native FreeBSD versions of their applications. The problem is, that most of these companies do not really realize how many people would use their product if there were FreeBSD versions too, and most continue to only develop for Linux. So what is a FreeBSD user to do? This is where the Linux binary compatibility of FreeBSD comes into play.

So whether you should enable it or not is up to you, but if you’re in doubt, I’d recommend to enable it. Please refer to [2] for further information about the “Linux Binary Compatibility”.

Then I created a normal user to ordinary non-system work (before creating the user, create a group with the same name as your username). I might add, that if you enabled SSH-logins, an ordinary user account cannot su through SSH; for that, the user has to be in the wheel-group. You might as well do this while creating this new user like this:

Please be aware that FreeBSD is like Debian, not Ubuntu, in root/sudo regards. In Ubuntu you never login as root, you simply sudo. This approach is made to make it more secure for ordinary users. In FreeBSD and Debian you su to become root, do some administrative stuff, end then exit into the world of ordinary user privileges.

After the installation is done, you see the main menu again from where to do a standard installation. At this point eject the CD and reboot the system.

To install the man- and info-pages, you should execute the following as root (either log in or su):


In this utility you choose “Configure” -> “Distributions” -> and select “man” and “info” by hitting space -> “OK”. Now you can just exit the sysinstall tool.

Well, now the installation is done! Let’s see how to upgrade this bastard!

How to use ports and upgrade the base system

As mentioned earlier, I’m going to bet everything on ports!

When making system work, as we are going to do now, you must use su and not sudo! Please read [3] for an excellent review of how to use ports (you might as well wait to after reading my short recap of [3]). I’m now going to show one approach of getting and updating the ports tree, namely the portsnap-tool, and afterwards I’m going to show how to update the ports tree, how to install, upgrade, and remove new applications, and how to upgrade the binary base system.

Remember we chose the minimal installation, so we don’t even got the ports collection (or tree as it’s also called) yet.

First let’s fetch the ports tree:

portsnap fetch
portsnap extract

Or simply

portsnap fetch extract

In the daily administration we don’t want to extract it, because we’ve already got the tree. Instead we want to update it. Therefore you’re only going to issue the extract-part right after installation, and after that you need only to execute this:

portsnap fetch update

And now your ports tree (recall that it’s source code for a lot of programs you are able to install) is up to date! But what about the programs from the ports tree you’ve already installed? They are not updated by the portsnap-command. But before going through that, let’s first install a new program. The lsof (list open files) is used in the example in [3] and I’m going to use it here, too. Well, ports are located in /etc/ports - but it’s a directory system based on categories, so first we will need to find the source directory:

whereis lsof

Wonderful - navigate to this directory and let’s install it. Assuming you are in the directory returned by the whereis-command, just execute:


This will compile the program, but don’t install it. The binaries are in the same directory - nothing has been copied! So lets copy the binaries:

make install

And now you are able to run the program (you might need to log in and out if it doesn’t work straightaway):


Because compiling takes up a lot of workspace with temporary files, we clean up afterwards:

make clean

Well, nerds are lazy, so an abbreviation of make, make install, and make clean is this:

make install clean

I would recommend sticking to this command so that you remember to make clean. There is a but in this regard: dependencies require the make-files, so if you always clean up, compilation will take longer since the whole dependency tree has to be build, too. So please consider this before cleaning up. This is basically the way to install new applications. It’s really not that hard! During compilation, errors may arise. It’s important that you don’t just think they are irrelevant. They might be crucial.

One of the benefits with apt-get is both it’s good at cleaning up and resolving dependency issues. The cleaning up part when removing programs is in both cases with apt-get and ports based on the fact that the maintainer of the program has specified which files are copied when issuing the apt-get install or make install, so that they all can be delete when removing the program. Because of this there’s no reason why apt-get should clean up in a better way than the ports’ way of doing it. Well, we’ll get back to that shortly. Let’s first upgrade the lsof. As mentioned in [3], you should read /usr/ports/UPDATING before every update because it describes issues in regards to upgrading certain ports.

Basically there are three different tools to upgrade ports with: portupgrade, portmanager, and portmaster. portmaster does not depend on any other ports, only programs in the base system [3] - that I like! In addition it seems like a reasonable way it handles dependencies (so apt-get gets real competition at this point, too!). So that’s the tool I’ll use - feel free to choose another. Please refer to “ Upgrading Ports using Portmaster” in [3] to see how update is done. It’s straightforward! And I like the part that it’s able to install ports, too (as I said, read [3] - important facts is reveal themselves by reading documentation!).

If you haven’t read “ Upgrading Ports using Portmaster” in [3], you might have difficulties understanding the next part. For a cronjob I’d recommend to update the ports tree (but only the index file - please read on) and mail the portmaster -L output to yourself. Something like a cronjob like (edit the /etc/cronjob - and maybe configure the mail more properly):

0 5 * * * root portsnap -I cron update && portmaster -L | mail -s "Available updates" your@host.tld

The -I option tells the portsnap to update the index only and not the ports tree itself, and only be used with the update command. In this way it’s possible to find out which ports needs to be upgraded without destroying/overwriting your current ports tree. The cron command is like fetch, but it starts by sleeping for a random period of time before making the fetch - this way it’s avoided that several machines perform the fetch simultaneously. And update is like before (but remember the -I option). Well, you did of course read the –help and man, so you already knew this, right?

To remove a port you just type:


It’s actually the same way as remove a package. Well done, FreeBSD!

To update the FreeBSD binary base system, simply use the tool freebsd-update. To get available updates:

freebsd-update fetch

And to apply those:

freebsd-update install

So in FreeBSD the ports and the system is updated separately. Actually I like this approach. My fear of ports and keeping FreeBSD updated has almost gone away!

If you are interested in more great stuff & guides visit


^ Top | Copyright © 2007| css | xhtml