_model: page
---
color: primary
---
title: DragonflyBSD
---
body:

# 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
```

### 1.1. Recommended Steps to Setup `pkg`

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. Install `tor` DragonflyBSD's Package

Here we can choose to install the latest stable version, like:

```
pkg install tor
```

  ... or install an alpha release:


```
pkg install tor-devel
```

# 3. Configure `/usr/local/etc/tor/torrc`

This is a very simple version of the `torrc` configuration file in order to run a Middle/Guard relay on the Tor network:

```
Nickname    myBSDRelay    # Change your relay's nickname to something you like
ContactInfo your@email    # Please write your email address and be aware that it will be published
ORPort      443           # You might want to use/try a different port, should you want to
ExitRelay   0
SocksPort   0
Log notice  syslog
```

# 4. Start `tor`:

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](/relay/getting-help/). If your relay is now running, check out the [post-install](/relay/setup/post-install/) notes.
---
html: two-columns-page.html
---
key: 2
---
section: Middle/Guard relay
---
section_id: relay-operations
---
subtitle: How to deploy a Middle/Guard relay on DragonflyBSD
