A Complete Guide to Creating a Portable BSD by@noaahhh
1,080 reads
1,080 reads

A Complete Guide to Creating a Portable BSD

by Nuh YurdusevenSeptember 27th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

nomadBSD is a portable "persistent" and low-size BSD distribution. It can be written to a USB stick using the dd tool on any operating system. 1.2 GHz CPU speed and 1 GB of RAM are recommended as basic requirements. The system uses Openbox as the window manager, the system is based on FreeBSD, the package manager is pkg. With this command the system can be updated, the desired package can be installed and removed. When you want to install a virtual machine on Oracle VirtualBox, there is a dedicated section in the NomadDS manual for this.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - A Complete Guide to Creating a Portable BSD
Nuh Yurduseven HackerNoon profile picture

Hi, in this article, I am going to create a portable BSD operating system, nomadBSD. It’s quite useful and has a simple function. Let’s dive into the content.

What’s BSD?

BSD is a high-dimensional system. FreeBSD uses about 40GB, while nomadBSD needs about 5GB or more in the workspace. This system is also based on FreeBSD. However, as a result of improvements and changes, nomadBSD, a portable “persistent” and low-size BSD distribution, has emerged. #BSD and derivatives BSD, or Berkeley Software Distribution, is a plug-in chain created by the University of California for AT&T’s UNIX.

Derivatives such as FreeBSD, OpenBSD, NetBSD, DragonFlyBSD refer to UNIX-like operating systems. These systems are licensed systems, and their license is referred to as a BSD license in the literature. These are complex operating systems such as GNU/Linux distributions. The most popular BSD distribution is FreeBSD, and many BSD distributions are based on this distribution. BSD operating systems are extremely powerful and are the operating systems that power many servers. It is stated that BSD operating systems are more performant and, in most cases, noticeably faster than GNU/Linux distributions.

In addition, since it is much older than the Linux kernel, it offers a more stable user experience. Although the development speed is slower, the control of the code by a single architect at the top is the most important factor that ensures the stable operation of the code.

In many GNU/Linux distributions, the code in the master branch is not controlled by one person, and many people can change the code. BSD systems can also use Linux packages or window managers familiar with GNU/Linux distributions. For this reason, there may be many more software packages available on BSDs.

Installing & configuring nomadBSD

nomadBSD is a minimal operating system that can be used as a live system, “persistent” and ready to use directly with installation, automatically detecting hardware. 1.2 GHz CPU speed and 1 GB of RAM are recommended as basic requirements. Although it is not beyond USB-2.0, it can be used much more easily with USB-3.0 and above technologies. It was a very pale expectation to expect performance from an operating system that is already persistent and carried on USB.

You can boot by selecting your USB from the boot menu of any machine, and the operating system recognizes the hardware and initiates the system boot process. You can download the system using the link. Here, it is explained how to open the archive and how to write the image to the USB memory according to different operating systems. It can simply be written to a USB stick using the dd tool on any operating system. Then you can customize the system with the setup wizard and install it on the USB.

The disk encryption feature can be activated optionally during installation. During boot, it waits for you to enter the password you set to connect the disk and continues the boot process after matching. The system is persistent. At the first startup, the installation takes place with the installation wizard, and when the system is restarted, many software that may be needed for daily use such as browser, text-editor, FTP client, a simple code editor, the mail client will appear pre-installed.

Since the system is based on FreeBSD, the package manager is pkg. With this command, the system can be updated; the desired package can be installed and removed. The system uses Openbox as the window manager. The lightness and speed of this system are a chosen details. In addition, as seen here, window managers or desktop environments used in Linux systems can also work with BSD. When you want to install FreeBSD, you can install without a window manager. Then you can install desktop environments such as xfce4, KDE, gnome in the pkg repository.

Installation and review on Oracle Virtualbox

If you want to use it by creating a virtual machine on Oracle VirtualBox, there is a dedicated section in the NomadBSD manual for this. “.img” extension archive is converted into a virtual disk with VDI extension with VBoxManager.

$ VBoxManage convertfromraw nomadbsd-130R-20210508.amd64.img \ 
nomadbsd.vdi --format VDI

Then the disk size can be adjusted again with the same tool.

$ VBoxManage modifyhd nomadbsd.vdi --resize 10000

Then, after creating a new machine on VirtualBox and making the necessary system settings, this VDI virtual hard disk can be connected to the machine. At the first startup, the installation wizard welcomes us. Nothing is visible except the wizard. Do not close the window. Otherwise, you may have to restart the system.

Language and keyboard layout selection is made. It prompts again to add a second keyboard layout. You can skip adding.

After the timezone selection, the root password is determined. Username is preset as “nomad”.

You can encrypt the disk with the block encryption option with Geli. You need to set a password for this. This password is used before connecting the disk during boot.

Then the applications and shell to be used by default are selected. In summary, the actions to be taken are examined, and the system setup is started by pressing the “Commit” button. The installation process is completed quickly. When we restart, the boot is started by selecting multiple users.

Geli password is entered for disk encryption, and disk binding is performed. If you are using a USB memory stick after the system is turned on, you can make the network connection from the icon in the upper right.

Many packages that may be needed for daily use come preloaded. Many tool kits such as visual editor, office suite, mail client, a package manager with visual interface, firewall come pre-installed. You can install many packages with the pkg package manager. For example, neofetch package was installed from pkg package repositories below, and dangerous from ohmyfish themes was used in the fish shell.

Like all BSD systems, this is a very similar system to the GNU/Linux distributions that the average Linux user can easily get used to. The system is specially configured so that even beginner users can use it easily. For example, you can perform package update, deletion, and installation operations with OctoPkg graphical package manager. Here you can uninstall apps that come pre-installed but you think you won’t be using.

To install Linux packages on NomadBSD,

$ sudo -i 
$ sysrc linux_enable=YES 
$ service linux start

You can use these commands on shell. Then you can install the Linux packages in the pkg repository with the following command.

Tools and databases such as Java, docker, vagrant, MongoDB, ElasticSearch are also available in FreeBSD repositories. It can be easily installed using the pkg package manager. It is also possible to install this system on a disk.

But for me, a FreeBSD installation would be much more convenient for a workstation or a personal desktop computer. This system is a stable and FreeBSD-powered operating system designed as a lightweight alternative. For this reason, if heavy work needs to be done, a FreeBSD desktop would be a more appropriate and less tiring choice.

For those who want to switch to the BSD side with this distribution, I recommend that they start with GhostBSD first. They can then switch to FreeBSD and OpenBSD, which is a famous security-oriented operating system. This sorting will greatly reduce the feeling of unfamiliarity in the transition process.

Also published here.