How to Install a DragonFly BSD System

Selecting Your Install Image

Installing DragonFly BSD is extremely simple, even moreso than most Linux distros, it can be done in a matter of minutes, depending on your drive speeds. However, there are just a few considerations to be aware of.
First and foremost is how you want to install the system, recently flash drives have been the most popular way to install a new OS. DragonFly, like most other BSD's has two separate types of install images, there's an install ISO which must be burned to a CD or other optical drive, and an IMG file which must be burned to a flash drive. This may seem abnormal for those of you coming from Linux, but Linux distros are actually the abnormality in this case where they release hybrid ISO images that can be used both on optical media and flash media.

FreeBSD/TrueOS/DragonFly BSD:
dd if=/path/to/DragonFly.img of=/dev/da%d bs=4m && sync

dd if=/path/to/DragonFly.img of=/dev bs=4m && sync

dd if=/path/to/DragonFly.img of=/dev/sd%c bs=4M conv=fsync status=progress && sync

Starting the Installer

To start the installer, simply enter the username "installer" at the login prompt, this will start the ncurses based installer, which will guide you through the necessary choices to get DragonFly BSD installed properly.
The installation consists of only 4 mandatory sections:

Fortunately, these steps are handled in one of, if not the most elegant manner I've ever come across in an installer. I generally loathe installers for being too inflexible, or for being overly complex to install the OS, but this installer manages to strike a rare, fantastic balance between simplicity and flexibility.
Once you get started, you'll need to select the filesystem you want to use, HAMMER, HAMMER2, or UFS. Under no circumstances should you pick UFS, if you need to transfer data to other BSD's and can't use a network sync or transfer program like scp or sshfs, you can use a portable drive formatted as UFS or FAT32. HAMMER2 is not yet considered to be production ready, but has been stable in my experience and should serve just fine for a workstation or personal install. If you need something more battle-tested, simply use HAMMER, it has several interesting features, like acting as version control for each PFS, or being able to configure master/slave systems, even over a network connection to mirror your PFS to another drive, even on another host.
The most useful feature though is the undo(1) command, allowing you to potentially recover any previous state of a file you just realized you accidentally deleted. HAMMER2, while still not considered to be stable enough for prime time use, has some exciting features and is slated to gain more as development continues. At this time, it's a fairly simple CoW filesystem with transparent compression available, much like ZFS. But it's meant to eventually gain clustering and drive spanning features, so it'd be possible for a whole datacenter to use the same HAMMER2 filesystems as if they were native, regardless of which host they actually belong to. It may even be possible to implement features such as boot environments, like Illumos and FreeBSD have with ZFS.

Once you've selected your desired filesystem, you'll be directed to a simple menu asking you how you'd like to split up your drive. Feel free to make any changes you think are necessary, though the defaults should be fine for the majority of installations.
After that's been completed, the installer should begin to cpdup(1) the OS onto the newly created filesystm(s). This is similar in concept to using dd(1) to copy an installed system to a new filesystem, so hopefully you verified the checksum of the install image!
This should only take about 30s, depending on the speed of your drive. Once complete, you'll be prompted to install bootblocks, to which you should say "yes". Congratulations! You now have a DragonFly BSD system ready to go! There's some additional configuration options available from the installer menu, like setting the system keyboard, configuring a network interface, managing services and locale information, and even chroot-ing into the installed system to do some manual configuration. Of course, this can all be done after rebooting into the installed system as well, so it's up to you if you want to take care of those configurations now, or later.


While not strictly necessary, I highly recommend not setting a root password in the installer, this allows you to quickly gain access to the installed system after rebooting, where you can then run:

	root:*:0:0:Charlie &:/root:/bin/csh
	toor:*:0:0:Bourne-again Superuser:/root:
to "star out" the root password as shown above. If you're unfamiliar with vi(1), this may be difficult to do properly, you can use the 'h,j,k,l' or arrow keys to navigate the cursor to the colon directly after "root", hit 'i' and '*', then hit Escape, then ':wq' to save and close the modified document. This will prevent anyone from being able to log in as root or use su(1) to escalate their privileges. Because of this, it's important to have a network connection configured so you can install and configure either sudo(1) or doas(1) so a regular user can escalate privileges without needing to know the root password.
I also recommend making the following changes to some of your system configuration files:
	# Enable ssh for remote work
	# Turn off sendmail
	# Enable pf(4)
	# This should be on by default, but it's DragonFly's NTP Daemon
	# Disable the bell, so your PC isn't beeping at you
	# Needed for chromium to work properly
	# General System Hardening
	## These prevent other non-privileged users from seeing your 
	## processes and threads in the output of ps(1)
	## Take Advantage of ASLR 
	## Randomize the PID value
	## Prevent Hardlink Abuse
These files can be modified with any text editor, if you're not familiar with any of the popular editors like vi, vim, emacs, or neovim, you can use ee(1) with the invocation of:
	sudo ee /etc/rc.conf
Of course, if you would rather use something like nano, you need to either use pkg_ng or the dports collection. For example:
	# pkg_ng, the binary package manager
	pkg install nano
	# Using the Dports collection, for compiling packages yourself
	cd /usr
	# This only needs to be done the first time, updates are handled via `make dports-update`
	make dports-create-shallow 
	cd dports/editors/nano
	make config install
This installs nano to /usr/local/bin/nano, if you are using csh or tcsh as your interactive ${SHELL}, you'll need to run the command `rehash` to update the list of programs that the shell can run, then you can use:
	nano /etc/rc.conf

Additional Resources

This should get you far enough to be able to have a working DragonFly BSD installation. Be sure to check the community maintained documentation available here to ensure you have the best documentation possible for what you're trying to accomplish, as I may not cover it in my adventures here.