Wireguard on Raspbian Buster

Rasbian Buster doesn't have wireguard packages available. There are only available on Raspbian Bullseye (testing). To install them we can use APT Preferences.

Enable the mirror and set apt pinning

# echo "deb http://archive.raspbian.org/raspbian/ testing main" > /etc/apt/sources.list.d/raspbian-testing.list
# cat << EOF > /etc/apt/preferences.d/raspbian-testing
Package: *
Pin: release a=testing,n=bullseye
Pin-Priority: 50

Package: wireguard wireguard-*
Pin: release a=testing,n=bullseye
Pin-Priority: 999
# apt update

Check that apt policy is OK and install it

# apt policy
50 http://archive.raspbian.org/raspbian testing/main armhf Packages
     release o=Raspbian,a=testing,n=bullseye,l=Raspbian,c=main,b=armhf
Pinned packages:
     wireguard-dkms -> 1.0.20201112-1 with priority 999
     wireguard-tools -> 1.0.20200827-1 with priority 999
     wireguard -> 1.0.20200827-1 with priority 999

# apt install wireguard

Note: Wireguard is not built on the raspberry kernel so it will be compiled as a module with DKMS which take a few minutes.