Part 4 - Build CoreDNS
- In Part One, We talked about hardware.
- In Part Two, We got Ubuntu on your MicroSD card.
- In Part Three We got everything set up to my personal liking, but ymmv.
- In Part Five We deploy and configure CoreDNS
- In Part Six We add a few odds & ends to make the host more durable
- And in Part Seven We add the bits for the eInk display
- Build Packages
- Unbound Libs
- Setup Golang
- Build CoreDNS
Some Packages that we are going to need for building:
apt-get install make build-essential git
If you’re going to use the unbound resolver plugin, then you’ll need to install a few additional packages:apt-get install libunbound-dev libunbound8 libevent-2.1-7
You will be able to The main Download page on the golang site1
https://go.dev/dl/go1.19.linux-arm64.tar.gz https://go.dev/dl/go1.19.1.linux-arm64.tar.gz
Remove any previous Go installation by deleting the
/usr/local/go
folder (if it exists).Extract the archive you just downloaded into
/usr/local
, creating a fresh Go tree in/usr/local/go
:$ rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.linux-arm64.tar.gz
(You may need to run the command as root or through sudo).
Do not untar the archive into an existing /usr/local/go tree. This is known to produce broken Go installations.
- Add
/usr/local/go/bin
to the PATH environment variable.- You can do this by adding the following line to your
$HOME/.profile
or/etc/profile
(for a system-wide installation):
- You can do this by adding the following line to your
- Validate it's in your path by (after logging out and logging back in) inspecting the `$PATH` env var: One way to skin the cat: `env|grep PATH`
Note: Changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile.
Verify that you’ve installed Go by opening a command prompt and typing the following command:
$ go version
Confirm that the command prints the installed version of Go.
Building CoreDNS is pretty simple, once all the pieces are in play.
REPO=https://github.com/coredns/coredns.git
REPO=https://gitlab.wolfspyre.io/mirrored_repos/coredns/coredns.git
cd /usr/src && git clone ${REPO} && cd /usr/src/coredns
cp plugin.cfg plugin.cfg.orig
So… because the ordering of the plugins in the plugin.cfg
file. Our additions fall just after the line containing template:template
…
wc -l plugin.cfg
72 plugin.cfg
head -53 plugin.cfg |tail -1
template:template
tail -20 plugin.cfg|head -1
template:template
So, we now know that in this version of CoreDNS, our changes should be injected between lines 53
and 54
so lets do that horribly real quick:
cat plugin.cfg > plugin.cfg_orig
head -53 plugin.cfg >wpl_plugin.cfg
cat <<EOF>>wpl_plugin.cfg
git:github.com/miekg/coredns-git
mdns:github.com/openshift/coredns-mdns
netbox:github.com/oz123/coredns-netbox-plugin
unbound:github.com/coredns/unbound
finalize:github.com/tmeckel/coredns-finalizer
records:github.com/coredns/records
EOF
tail -19 plugin.cfg >> wpl_plugin.cfg
cat wpl_plugin.cfg > plugin.cfg
SWEET!
so now we have our plugin file… populated with our changes… letas build this sucker!
cd /usr/src/coredns; make clean;CGO_ENABLED=1 make
Yeah…. I know… somewhat anticlimactic.