Imporant: Make sure secure boot is disabled on host OS i.e. Rocky Linux / Centos
sudo dnf install elrepo-release epel-release -y
if you face any issue running dnf update
after installing elrepo
then edit /etc/yum.repos.d/elrepo.repo
and comment out mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo.el8
sudo vi /etc/yum.repos.d/elrepo.repo
# mirrorlist=http://mirrors.elrepo.org/mirrors-elrepo.el8
sudo dnf update -y
sudo dnf install kmod-wireguard wireguard-tools -y
sudo dnf copr enable jdoss/wireguard
sudo dnf update -v
sudo dnf install wireguard-dkms -y
sudo modprobe wireguard
reboot
Now you should be able to run wireguard on Rocky Linux / Centos
git clone https://github.com/uzairali001/docker-wireguard-rhel/ ./wireguard
cd ./wireguard
docker compose up -d
if you get this error
modprobe: ERROR: could not insert 'ip_tables': Exec format error
wireguard | iptables v1.6.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
wireguard | Perhaps iptables or your kernel needs to be upgraded.
wireguard | [#] ip link delete dev wg0
then run this
sudo modprobe iptable_raw
To make it load automatically after reboot
sudo echo "iptable_raw" | sudo tee /etc/modules-load.d/iptable_raw.conf