As root

echo "deb http://ftp.debian.org/debian stretch main contrib" >> /etc/apt/sources.list apt update apt upgrade -y reboot

Now we are going to install the linux headers for the current linux version apt install linux-headers-$(uname -r)

Now we are going to install zfs itself. This is going to take a while apt install zfs-dkms