I use this on Ubuntu 16.04, but as long as your systemd is recent enough, I don't see why this should not work for you.
- Set your IP address to a static one, using e.g. NetworkManager or by editing
/etc/network/interfaces. Set127.0.0.1as your DNS server. - Write the
/etc/systemd/system/pihole.servicefile below. - Start and enable ("install") the systemd unit file by typing
sudo systemctl start pihole.serviceandsudo systemctl enable pihole.service. - Configure your other devices to use your computer's now static IP address as their DNS server.
Here's what you should put in /etc/systemd/system/pihole.service: