Operating systems

FreeBSD 8.0 installation walk-through

Vincent Danen walks you through the initial installation of FreeBSD 8.0. The text-based installer can be a challenge, but the OS is solid.

FreeBSD, and the other BSDs, are exceptionally stable and powerful operating systems, but they can be quite different from Linux. Although they share common principles and ideals, and a huge amount of software, when it comes down to it, FreeBSD and Linux are two different beasts. This doesn't make FreeBSD better or worse, but it is something to be aware of. Perhaps the most challenging thing about FreeBSD is the initial installation. While PC-BSD, another BSD variant, has made a lot of headway in making BSD easy to use, FreeBSD is still king as far as the BSD's go.

With the recent 8.0 release, it may be time to give FreeBSD a look. FreeBSD is favoured by many for service management and hosting, running Web servers and mail servers, etc. But it works as a fully functional desktop as well. This tip will take a quick walk through the installation. Fortunately, or unfortunately, depending on whether or not you are familiar with installing FreeBSD, the installer has not changed significantly over the years. Yes, it is still text-based.

To begin, once FreeBSD boots, select your country region, then select Standard installation. The next section is where you partition the hard drive. If this disk already has partitions, you'll likely want to delete them. Creating a dual-boot system with FreeBSD and Linux or Windows isn't impossible, but beyond the scope of this tip.

BSD operates on the concept of slices, which are similar to partitions in a lot of respects. To create a new slice to cover the entire disk, press [A]. Once this is done, press "S" to set it as bootable, and then [Q] to proceed.

The next screen asks if you need a boot manager. If the only operating system is FreeBSD, select the Standard option, which writes to the MBR and does not require a boot manager. Otherwise select the installation of the FreeBSD boot manager or elect to install nothing (useful if you plan to have something like grub be the boot manager if dual-booting).

The next part is to set up the partitions and mount points. This is where things may get confusing. Partitions live within slices, and you can have more than one partition per slice. Theoretically, you could have created multiple slices previously, and used each slice for one partition. Instead, we've created one slice and will create multiple partitions inside of this slice. On a 20GB drive, you could use a layout similar to the following:

  • ad0s1a: 2000M, filesystem mounted as /
  • ad0s1b: 500M, swap
  • ad0s1d: 7000M, filesystem mounted as /usr
  • ad0s1e: 3000M, filesystem mounted as /var
  • ad0s1f: 8000M, filesystem mounted as /home

Click to enlarge.

Once you have set up your partitions the way you want, press [Q] to finish and write the changes to disk.

On the next screen you get to select the package set. There are a few choices to choose from, including Developer, User, or All. You can also go through using Custom to select which packages you want installed; there isn't a lot to the base FreeBSD, so selecting All is the safest bet.

When asked to install the ports collection, select Yes. It is well worth it as you will be able to install a number of additional applications. Once you have made your choice, select Exit to proceed.

Next, you can select where to install FreeBSD from; likely it will be from CD or DVD so choose that option. Once this is done, FreeBSD begins the installation. This will likely take a while, depending on what you elected to install and the speed of your hardware.

After this, FreeBSD starts the sysinstall program, which can be used at any point later on to re-configure parts of the system. Sysinstall handles configuring the network interfaces, creating a user, setting the root password, and setting up initial services. There are plenty of dialogs and instructions here.

Unfortunately, FreeBSD is a great operating system with an unholy awful installer -- compared to other operating system installers currently available. Some people are comfortable with text-mode installers, some aren't.

They are nothing to be afraid of if you have a moderate amount of knowledge, but for those who absolutely require a more up-to-date installer, PC-BSD may be of more interest than FreeBSD. Having said that, the installation is probably the hardest part of using FreeBSD, so if you've made it through this, FreeBSD is a lot of fun to play with.

Once the system has booted, unless you intend to use the install as a server, you will want to install X. You can install X using the ports system, which compiles from source, or by installing the binary package using the pkg_add command:

# pkg_add -r xorg

The FreeBSD Handbook is probably one of the best sources of information on installing and using FreeBSD. Here you will find out how to configure X and other aspects of your FreeBSD system. If you run into any trouble, be sure to reference it.

Get the PDF version of this tip here.

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

14 comments
Justin James
Justin James

... is that is runs under Hyper-V, which previous versions didn't. In fact, I was able to perform a P2V conversion on a FreeBSD box without too much hassle, and was able to take down a physical server as a result (it's a small little mail/Web server without much usage). J.Ja

Silverlokk
Silverlokk

1. PC-BSD isn't exactly another BSD variant, since it's based on FreeBSD (their Website includes the FreeBSD logo). 2. Another FreeBSD variant that also has a graphical installer is DesktopBSD. 3. AFAIK (have to work from memory because it's been some time since I installed DtBSD), both PC-BSD and DtBSD install X by default. 4. Both PC-BSD and DtBSD have graphical package managers. Last time I looked at PC-BSD, it had its own packaging system. DtBSD ,OTOH, uses the FreeBSD ports system. I know you're using mainly the terminal, but this info may be useful for those who prefer working in a GUI.

svig
svig

FreeBSD rocks... We have several servers that have been running for literally years without a reboot. Current record holder is 1184 days.

amahling
amahling

I think FreeBSD is worth a look especially for the technical minded Linux user. Because of its clear separation of OS and applications you can have a operating system solid and stable for many years along with all the bells and whistles of the newest application out of the ports. On the bleeding edge of firefox without constantly updating kernel an C runtime! In the Linux world I found only RHEL/CentOS + extra repositories comparable.

Neon Samurai
Neon Samurai

how are kernel updates managed? Does FreeBSD patch the live kernel in memory when it drops the new kernel image on the drive?

Neon Samurai
Neon Samurai

One of the things that attracted me to Debian was the dist-upgrade to move between major version releases. It's very close to a rolling distro except for the major version releases. Distrobution Upgrade is very clean between versions though. An update process is obvious for programs within a major version but how does FreeBSD manage it? Would it be closer to Metasploit by svn where I continue to get updates and every now or then the major version number happens to change? (It really is time that I cut a new FreeBSD VM and had another go.)

DanLM
DanLM

First Neon, ltns. Next, I just installed FreeBSD 8 on my home machine. I actually took the time(for once) to go look for security updates after the freash install. Used the procedure found here: http://www.cyberciti.biz/tips/howto-keep-freebsd-system-upto-date.html The top half of this article is about ports and packages. Scroll down to the title: [b]How do I apply binary security updates for FreeBSD?[/b] Comes down to the following: Fetch updates Use fetch option to get all available binary updates: # freebsd-update fetch Install updates Install the most recently fetched updates: # freebsd-update install Rollback updates Optional: You can uninstall most recently installed updates: # freebsd-update rollback Reboot system You must reboot FreeBSD to take advntage of newly patched kernel: $ uname -a ------------- I used that procedure exactly. No problems, real easy. By the way, I installed xorg(for the very first time) by compiling it. Use the package install. MUCH EASIER, MUCH FASTER. I had to install xorg(don't use it) because I wanted to dedicate this machine to crunching numbers for seti. And boinc(in the ports) required that xorg be installed. Again, good to see ya again Neon. Give it a try, I swear by FreeBSD. If you remember me, you should know that. ;o)

DanLM
DanLM

I own a FreeBSD buisness machine, and I have had it sence FreeBSD 6.0. Moving from version to version was done through upgrades. Pretty much a download of latest source and recompile with a few additional steps. This is all documented in the FreeBSD handbook http://www.freebsd.org/doc/handbook/current-stable.html Also, any installed packages/ports are easly upgraded also. I use samba at home and apache on my buisness machine. I have tried to keep apache up to date for any changes. http://www.freebsd.org/doc/handbook/ports-using.html

Neon Samurai
Neon Samurai

First, the desired use. If you want a quick VM not looking to recieve network connections then VirtualBox is very nice. It's messy to configure bridged networking versus NAT though which makes it not so good for a server VM but great for a Workstation install. I've used it to develop kios installs and similar outward bound systems. VMware is my prefered brand; partially because it's my first but mostly because it's cross platform, free and does bridged networking beautifully. I keep a groupware and IDS VM that auto-boots after the host OS comes up. Since it's bridged overmy desktop's NIC, it gets to sniff host traffic and any other VM I'm running. This is handy for an auditing VM I keep available but don't run all the time. caveates; VMware's natural *nix is Red Hat but I've had no issues with it on Mandriva. I've had some hickups getting it on my less than standard Debian install (all good but management by https but it's a localhost service anyhow). My experience is not the general experience though. It has Ubuntu deb packages also. If your going to dedicate it to VM hosting you could even look at VMware ESX which has a freely available version; it takes over the bare metal as the host OS though so everything usable beyond that would be within a VM. Host OS being whats on the metal and guest OS being a VM. You need enough hard drive space for host OS plus the guest OS HDD file and ideally whatever ISO you mount into the VMs virtual drive. You need enough ram for the host OS plus whatever you are going to allocate to the VM. VM's ram needs depends on OS and usage; my groupware with various IDS has 256 MEG dedicated to it. A *nix server for testing is usually fine around 256 MB also. A workstation test I'd aim for 512 MB ram or a gig. Given a host OS of 1Gig or more, that means I'm looking at 1Gig + 256 MB + ram need for the applicable 2nd VM if I'm working on one. A p4 with 500MB HDD and 1Gig ram might be tight but if it's a machine you don't mind mucking with then it's worth a go. Unless you go with ESX, what's the most minimal *nix build you can squeeze onto the machine including VMware dependencies? A high estimate may be 512 MB host OS and buffer room, 256 MB dedicated server VM, 256 periodically used testing VM. If you go Virtualbox (likely in Ports), you'll need to do some searching about how to setup a bridged NIC virtual device for it based on your chosen host OS. That may kill your dedicated server VM need. NAT networking will do your test VM happily though as it's outward bound. (You could also ssh forward ports from the server VM to the host OS or something else outside Virualbox.) For my last system upgrade, I spoiled myself based on my usual benchmark of enough hardware to push gaming plus my new benchmark of enough hardware to push multiple VMs. The irony is that I now lack the extra machines I've always had around to juggle OS separate from my workstation but actually have more OS bootable and waiting on VMs. Anyhow, the first step would be installing VMware or Virtualbox. VMware should be an easy untar and run the setup script (setup.exe style but cli). Virtualbox should be in ports given it's popularity. Let me know which you pick, what questions I've caused or what grief you run into installing them. I'll answer what I can. (if you go with Xen or something else, I can help with generalities but haven't used those VM apps specifically)

DanLM
DanLM

I have never done anything with virtual machines. Alot of the reason being I really never felt I had a robust enough of a machine. One of the main reasons I would like to play with VM is because of me yuking around with my os's. Ie: I would like to run 24/7 a specific release of FreeBSD 8.0. I would like to have a vm of a modified or upgrade os to test. Not running at all times, but in an easily throw away setup. And if I find that my modified os does what I hoped, to easily overlay my 24/7 FreeBSD. The machine that I installed BSD 8.0 on is a p4 with a gig of memory. And a 500 gig hard drive.Would this machine be robust enough? Could I run a vm on it like I previously described? right now, BSD is a boinc/seti cruncher for me. Nothing more. I will probably install mysql and Apache soon, but it hasnt happened yet. Also want to play around with it to get wireless working so I can move it out of the living room into another room. ?? Any and all help would be appreciate with regard to VM. Dan

Neon Samurai
Neon Samurai

I think my last go was OpenBSD which didn't much like VMware at that time (around VM server 1). FreeBSD is a whole other beast though and much has evolved since my last go.

Editor's Picks