1. Bootstrap pkg

DragonFlyBSD's daily snapshots and releases (starting with 3.4) come with pkg already installed. Upgrades from earlier releases, however, will not have it.

If pkg is missing on the system for any reason, it can be quickly bootstrapped without having to build it from source or even having DPorts installed:

cd /usr
make pkg-bootstrap
rehash
pkg-static install -y pkg
rehash

Here, it will be similar to what we have on a FreeBSD system, and we are going to use HTTPS to fetch our packages, and updates - so here we also need an extra package to help us out (ca_root_nss).

Installing the ca_root_nss package:

pkg install ca_root_nss

For fresh installations, the file /usr/local/etc/pkg/repos/df-latest.conf.sample is copied to /usr/local/etc/pkg/repos/df-latest. The files ending in the ".sample" extension are ignored; pkg(8) only reads files that end in ".conf" and it will read as many as it finds.

DragonflyBSD has 2 packages repositories:

  • Avalon (mirror-master.dragonflybsd.org);
  • Wolfpond (pkg.wolfpond.org).

We can simply edit the URL used to point out the repositories on /usr/local/etc/pkg/repos/df-latest and that's it! Remember to use pkg+https:// for Avalon.

After applying all these changes, we update the packages list again and try to check if there's already a new update to apply:

pkg update -f
pkg upgrade -y -f

2. Package Installation

Install the tor package:

pkg install tor

... or install an alpha release:

pkg install tor-devel

3. Configuration File

Put the configuration file /usr/local/etc/tor/torrc in place:

#change the nickname "myBSDrelay" to a name that you like
Nickname    myBSDRelay
# You might want to use/try a different port, should you want to
ORPort      443    
ExitRelay   0
SocksPort   0
Log notice  syslog
# Change the email address below and be aware that it will be published
ContactInfo tor-operator@your-emailaddress-domain

4. Start the service

Here we set tor to start at boot time and use the setuid feature, in order to bind to lower ports like 443 (the daemon itself will still run as a regular non-privileged user).

echo "tor_setuid=YES" >> /etc/rc.conf
echo "tor_enable=YES" >> /etc/rc.conf
service tor start

5. Final Notes

If you are having troubles setting up your relay, have a look at our help section. If your relay is now running, check out the post-install notes.