To install wireguard on an older Linux kernel. This is for versions greater than 3.10.
To check your linux version:
uname -r
yum install elfutils-libelf-devel kernel-devel pkgconfig "@Development Tools"
Clone the sources:
git clone https://git.zx2c4.com/wireguard-linux-compat
git clone https://git.zx2c4.com/wireguard-tools
Update wireguard-linux-compat/src/socket.c with the following after the includes:
#undef ipv6_dst_lookup_flow
#define ipv6_dst_lookup_flow(a, b, c, d) ipv6_dst_lookup(a, b, &dst, c) + (void *)0 ?: dst
Then make and install wireguard:
make -C wireguard-linux-compat/src -j$(nproc)
make -C wireguard-linux-compat/src install