While Linux distributions may get the greatest amount of ink in the open-source world, people often overlook the BSD family. One BSD variant, NetBSD, has stuck around because of its commitment to portability.
What Is NetBSD?
NetBSD is an open-source operating system. Like Linux, NetBSD aims for broad compatibility with Unix, offering similar utilities and behavior.
NetBSD is based on the Berkeley Software Distribution version of Unix, hence the "BSD" in the name. It's a branch off of the 386/BSD release that supported PCs in the early 1990s.
Where FreeBSD focuses on the PC platform and OpenBSD focuses on security, NetBSD focuses on portability to different platforms. While NetBSD might look like another Linux distribution, the entire system, including the kernel and user utilities, is developed together as a whole. This contrasts with the way Linux distributions cobble together components from multiple sources.
History of NetBSD
While NetBSD is a modern operating system, its lineage dates back to the 1970s, as the Berkeley Software Distribution or BSD, developed at UC Berkeley.
BSD became the technical leader of the Unix world through the 1980s, as workstation vendors like Sun Microsystems, co-founded by BSD programmer Bill Joy. Berkeley was also a pioneer in open-source software, only requiring a copyright notice and refraining from mentioning the university in advertising.
BSD was originally based on Bell Labs' Unix but diverged from its parent company AT&T's version over the years so that a version could be released that contained no AT&T code.
Though it wasn't a full OS, this "Networking Release" was so named because it contained the TCP/IP networking code used by several companies to implement networking in their products. It even eventually made its way into Microsoft Windows.
As PCs got more powerful with the advent of the Intel 80386 CPU, William Jolitz ported BSD to the 386 processor using the Networking version as a starting point, which he released as 386BSD. Jolitz had trouble keeping up with all the patches that other developers were sending him to improve the system, so forks of the project appeared immediately.
One group wanted to keep improving the version for the PC, while another wanted to focus on portability across different architectures. The former became FreeBSD, and the latter became NetBSD.
NetBSD was forked in turn as one of the developers, Theo de Raadt, was asked to resign from the NetBSD project and later founded a variant, OpenBSD, which focuses on security and code correctness.
Portability: “Of Course It Runs NetBSD”
NetBSD has made its name on the vast number of ports available for current and abandoned hardware of all the Unix-like systems. It achieves this by separating machine-dependent code from machine-independent code.
The list of current ports includes x86_64 and ARM to more obscure architectures like MIPS. And that's just the Tier I ports, the ones that the NetBSD project actively supports.
The list of Tier II ports is also extensive, which is where most of the support for "orphaned" hardware lies. Here, you can find versions for the Amiga, Motorola 68000 and PowerPC-based Macintoshes, 32-bit Sun SPARC workstations, and VAX Minicomputers.
You can even find a port for the Sega Dreamcast game console. Many people looking for new software to run on older hardware find NetBSD attractive. If you can't find a Linux distro to run on your old machines, it's a good place to look.
NetBSD is so portable that there's a saying, "Of course it runs NetBSD." Someone even managed to install it on a toaster fitted with an embedded microcontroller.
Don't think you have to give up Linux programs if they don't have the source on your NetBSD system. Depending on the hardware platform, NetBSD offers Linux binary compatibility. This means you can run Linux programs on your NetBSD system.
Installing the OS is similar to installing a Linux distribution. You just download the installation image, boot it on your computer, start the installation program, partition your hard drive, install the software, choose a root password, and boot into your new system.
Reflecting the technical orientation of NetBSD and BSD in general, the installation interface is text-based.
You can install the software from the installation disk, but you can also install over FTP, from an NFS drive on the network, or even from an unmounted partition. NetBSD maintains detailed installation instructions for every architecture.
By default, NetBSD runs in a text console without a GUI. You can start X11 with the startx command.
The default window manager is CTWM. You can install other window managers and desktop environments with the package manager mentioned below. You can also log in graphically with XDM at boot time by adding the line "xdm=YES" to the bottom of the /rc.conf file as root, then rebooting.
Package Management in NetBSD
No operating system, including NetBSD, is set up the way you want it completely out of the box. You often have to install some programs to get it the way you want it. In the Linux world, package managers have made this job much easier. NetBSD also has its own package manager, pkgin.
You can install it during installation, but in case you didn't, all it takes is a couple of commands. At a root shell, enter these commands:
export PKG_PATH=https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d_ -f1)/Al pkg_add pkgin
To search for a package using pkgin, use this command:
pkgin search vim
To install a package, use the install option.
pkgin install vim
You'll also want to keep your system updated.
Should You Use NetBSD?
If you're wondering whether you should install NetBSD or not, the choice will depend on your situation. If you want to revive older hardware that doesn't receive official OS updates anymore, you should seriously look into NetBSD as an option.
If you're considering embedded systems development, the BSD license may be more attractive than the GPL common in Linux software because you don't have to make your source code available. That's why the BSDs are a popular base for hardware manufacturers like the later Sony PlayStations based on FreeBSD.
If you just want something different from the usual crop of Linux distributions, you might also consider NetBSD or one of the other BSDs. If you want a system that's more "Unix-like" than the way Linux has evolved, NetBSD might be a breath of fresh air. Some people really don't like the systemd init system in Linux because they believe it's too bloated. NetBSD tends to be lean and mean.
A Unix OS That Runs on Just About Anything
NetBSD, with its heritage dating back to the original BSD of the 1970s and 1980s, is unique as a real Unix system with the aim of running on as many different kinds of computers as possible.
One popular use for old computers is as a home server. You can use NetBSD or a Linux distribution to get your server up and running.