💾 Archived View for gemini.circumlunar.space › users › kraileth › neunix › eerie › 2015 › fbsd_insta… captured on 2023-04-26 at 14:26:43. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-05)
-=-=-=-=-=-=-
Here I'm republishing an old blog post of mine originally from Juli 2015. The article has been slightly improved.
This article deals with installing FreeBSD. It's meant for the first time FreeBSD user who has a Linux background.
The installation process is actually quite simple and straight-forward. I'll guide you through in some detail, anyways, because I think that there are a few things that are _good to know_ even if they are not _strictly_ necessary.
(On a side note: My blog turned three a few days ago. I decided not to write a birthday post this year; let's just get on with some real content!)
The easiest way to try out a new operating system these days is to run it in a virtual machine. I'm using _VirtualBox_ to create the screenshots and you are invited to create a VM, too, and follow along. Just reading the post is also fine, though. And of course nobody will stop you if you decide to dedicate a real machine to this project because you have some spare hardware around.
If you opted for VirtualBox, you just need to create a new VM first. Select FreeBSD as the OS and give it a bit more RAM and far more disk space (since we're actually going to put our new system to some use) than VirtualBox suggests. Other than that, you're set up. You should not need to make any other changes (though you can of course adjust things if you feel like it).
Now download an ISO image if the installer CD from here:
We'll be using FreeBSD _10.1-RELEASE_. Pick the right one for your CPU architecture - if you've got a PC then _i386_ means "32-bit" and _amd64_ means "64-bit". That's the architecture, it doesn't matter if you've got an Intel or an AMD CPU. Make sure you choose an _installer image_ and **not** a _virtual machine image_ since we want to install FreeBSD after all!
The smallest image is fine; that's _FreeBSD-10.1-RELEASE-amd64-bootonly.iso_ for a 64-bit system (or the .xz one which you need to decompress after the download). If you were going to install FreeBSD on several machines or on one that is not connected to the net, it would make sense to choose a bigger one which actually includes the OS distribution sets you want to install. But for our purpose the _bootonly_ (where the installer will download the OS files from the net) suffices.
Got everything? Excellent. Start up your VM and put the installer image into the virtual drive. Then you're set to go.
You should be greeted by the bootloader. Either wait ten seconds or just press the Enter key (we don't want to set any special options at this early stage) and the system will boot.
The FreeBSD bootloader screen aka "Beastie Menu" (PNG)
Now the kernel will probe your hardware and the system will come up. Once everything is done, the installer will be started automatically. It's not the most beautiful installation program ever, but it does the job. And it actually makes the installation really easy. Until FreeBSD 8 there was the old installer, BTW. It was more powerful but the installation was also more complex (and it was even more ugly! 😉).
Meet the FreeBSD installer! (PNG)
After choosing "install" you can select a keymap or go with the default one (US). It's all up to you here.
Keymap selection in the installer (PNG)
Then we have to give the virtual computer a name. I decided to call the machine _beastie_ which is the name of FreeBSD's mascot (the little red daemon with the fork).
Setting the hostname of the machine (PNG)
Next select which optional sets to install. You won't need _doc_. This may have been very useful in the past but today you'll probably want to simply browse the documentation online instead of locally, anyways. If you really want it, it won't hurt you, though, but you could just as well save yourself (and the FreeBSD project) some bandwidth.
_Games_ is not what you probably think, BTW. It's pretty obvious that this won't install DooM or Quake or the like. But it's not even something like Solitaire or Freecell that comes with Windows. It's in fact just a bunch of command-line based "games", the most popular being _fortune_ mentioned by the installer. It is a "fortune cookie simulator".
Most people probably wouldn't call any of the programs from this set an actual game. They are more or less just little fun or joke programs. Actually they have a long tradition with Unix and they are very small, too. For that reason they are included in a FreeBSD install by default. You may deselect this set if you really want but they definitely won't hurt you, either.
Choosing the sets to install (PNG)
The _lib32_ set contains the 32-bit compat libraries which are needed if you want to run 32-bit executables on a 64-bit FreeBSD system. There are actually more cases where you need them than you might think. So if you aren't really, really short on disk space or know exactly that you won't ever need them (hint: When you are just starting with FreeBSD, you don't) just leave this one checked.
For our tutorial please make sure you uncheck the _ports_ and _src_ sets which contain the ports tree and the system source code respectively. We will need both later - but we'll fetch the _current version_ of both them using different a different means!
Now you need to configure your network so that the distribution sets can be downloaded. This is a pretty straight-forward thing to do: Select your NIC (chances are you only have one, anyways), select IPv4 and choose DHCP if you wish to automatically receive an IP address (otherwise configure the NIC manually). You probably don't need IPv6 so skip that unless you're really actually using it in your LAN.
If you selected DHCP, FreeBSD should have received the address of at least one DNS server as well. If it didn't, make sure to provide one. Otherwise name resolution won't work and the installer cannot download the distribution files.
The next step is to select a mirror server from which to download. It obviously makes sense to choose one that is located in a place near to you as it is more likely to provide a good connection for you.
All that's left is setting up the hard disk(s). The basic choice you have to make is which file system you want to use. FreeBSD supports two native file systems: The traditional _UFS_ ("Unix File System" aka. FFS or "Fast File System") and the next-gen filesystem _ZFS_. The later is a sophisticated FS with a lot of interesting features. For quite some people the fact that ZFS is considered stable on FreeBSD is a killer feature of this operating system and even the main reason why they choose this OS.
ZFS however is well beyond the scope of this post. A dozen of posts like this could be written on that topic (probably not by me, though, since my ZFS knowledge is rather basic, at least for the time being). So we'll opt for _UFS_ for now.
Partitioning a FreeBSD system is a little bit more complex than partitioning Linux. Fortunately there's the _Auto (UFS)_ option in the installer. We select that and want to use the entire disk.
Disk partitioning choices (PNG)
Today there are two partitioning schemes in use on the PC. FreeBSD defaults to the newer one, _GPT_. You could also use the older _MBR_ instead if you have any reason to do so. And in fact you could even go without any of them! But that's going deeper than we need right now.
The installer suggests a default partitioning: A _boot partition_, one for the _root file system_ and one more for _swap space_. Depending on what you want to do with your FreeBSD machine, this is most likely not what you want. But for our test system it's fair enough.
The default partitioning layout (PNG)
After hitting "Finish" and "Commit", the changes are written to disk and the actual installation begins.
Partitions are a topic which can be highly confusing for the beginner (at least it has been for me before I did some research in this area). The problem here is that in the FreeBSD world a partition is something different what you might think. And to make matters worse, the terminology differs slightly even between the BSD projects!
Most Linux distros use the old _MBR_ ("Master Boot Record") partitioning aka "DOS partitioning" by default. Same thing if you come from a Windows background. You know the score: Up to four _primary partitions_ and _extended partitions_ if you need more than that. Chances are that your Linux distribution uses three primary partitions: One for /boot, one for Swap and one for /. If they are on the first hard drive (sda) of your PC, then they will be called /dev/sda1, /dev/sda2 and /dev/sda3.
These partitions are known as _disk slices_ in FreeBSD's terminology. So it's just a different name for the same thing, right? That cannot be so bad! Wrong. The MBR partitions are the same thing as the slices, yes. But the fun starts when you learn that the BSD systems use a mechanism called _BSD disklabels_. These divide the MBR partitions further and if you think in DOS terminology of partitions, disklabels actually allow for what might be called _sub-partitions_ as that is what they are. Unfortunately these are just called _partitions_ in the FreeBSD context!
So remember this: In FreeBSD a "partition" is what you may think of as a sub-partition and a "disk slice" is what you commonly know as a partition. How come that we have all this confusion? Who's guilty of causing it? Well, things are not so easy here...
Unix began its life not on the PC but on bigger mainframe computers which did not support partitions at all. So the Unix people came up with disklabels to partition disks into up to 8 partitions. Since that is what they are, it was an obvious choice to call them partitions. Quite some time later the PC platform supported MBR partitions which were also called thus. The real trouble started however when Unix was ported to the PC: Now there were two different things with the same name! For compatibility's sake, FreeBSD embeds its native partitions (as sub-partitions, remember) into what they call disk slices (MBR partitions) to be able to distinguish between the two.
As a consequence, FreeBSD needs only one disk slice (MBR or GPT partition) because it can create partitions (sub-partitions) on it, e.g. for Swap.
If you are using the MBR scheme, it leads to a naming like e.g. /dev/da0s1b. This means the _first SCSI disk_, _slice 1_ (= primary MBR partition 1), (BSD disklabel) _partition 2_. /dev/ada1s5f means _second SATA disk_, _slice 5_ (extended MBR partition 1), _partition 6_.
FreeBSD can also do entirely without slices. This is called _dangerously dedicated_ mode. The name sounds quite worrying but in fact the only "danger" is that it is highly unlikely non-BSD systems will be able to read any data from it (since they don't know about disklabels) - and e.g. Windows kindly offering to "format the disk" because there can't be anything useful on it, can it? If you ever come across something like /dev/da1d, you know that it's the _4th partition_ (BSD disklabel partition) on the "dangerously dedicated" (MBR partition-less) disk da1. If you just have *BSD on your drive, you can use this mode and there's no "danger" to your data.
Fortunately things got easier with the introduction of _GPT_ ("GUID Partition Table"), a newer partitioning scheme that supports more than the 4 primary partitions of MBR. And since more than enough partitions can be created this way, FreeBSD does not use disklabels to further sub-partition them on GPT. The good thing is that many other operating systems know GPT partitions, too. The bad thing is that we have another kind of partition that's just called a... partition.
Newer FreeBSD installations default to GPT partitioning. If you look for your drives then, you'll probably find them as something like /dev/ada0p1 which means _first GPT partition_ on the _first disk_ (partition numbers starting at 1 instead of 0 is due to GPT specifications).
If you have to use the older MBR partitioning for some reason, there are a few things you should know about disklabels. _Disklabel a_ is traditionally meant to hold the root filesystem (/), _b_ is for Swap. _C_ in turn is completely special; you cannot use it as a normal partition. It's always there and covers the whole disk. This is used by some tools to access the disk in raw mode, neglecting any partitions or whatever. Historically _d_ stood for the whole disk and c for the complete slice - but that time has passed and d is no longer special, allowing you to use it as you see fit.
That's a lot of information, I know. But you'll get the hang of it if you want to. It's not that difficult once you sort things out and overcome the confusion.
Now lean back for a while; the installer will fetch the distribution packages from the net first.
Fetching the distribution sets (PNG)
As said before, this step is skipped if you use a bigger image. In that case you'll also configure the network settings later in the installation process.
When all distribution packages were downloaded and extracted, you are prompted for a password for the root user.
Setting a password for the root user (PNG)
Then you have to tell FreeBSD about your time settings. If it is the only OS on your machine or it shares it with other Unix-like systems like Linux, go for UTC time on the CMOS. If you also have Windows on the same computer, however, be sure to select No here. Windows and UTC-based time is a mess. Now choose your local time depending on where you reside.
Choosing the time setting (PNG)
In the next screen you can choose which daemons should be started automatically during boot. Unselect _dumpdev_, it's of no use to us (if you were able to read crash dumps and debug the applications with this info, you wouldn't really read this post now, would you?). You can always re-enable it later if needed. Keep _sshd_ selected if you plan to use SSH.
Selecting the daemons for autostart (PNG)
Choose not to add any users right now. We'll be doing this later and learn a bit about user management on FreeBSD! Next hit "Exit", then tell the installer that you don't want to make any final changes.
Choose to reboot. And that's really it.
Reboot to finish the installation (PNG)
If you remove the installer image, your machine should boot into your new FreeBSD system. Welcome on board, new BSD user!
The next blog post will deal with some of the very basics of working with a freshly installed FreeBSD system.