How To Install Wireguard on Debian 11

Install Wireguard on Debian 11

In this tutorial, we will show you how to install Wireguard on Debian 11. For those of you who didn’t know, Wireguard is one of the well-known and great open-source VPN solutions. Wireguard aims for better performance and more power than IPsec and OpenVPN. Wireguard protocol passes traffic over UDP.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Wireguard VPN server on a Debian 11 (Bullseye).

Prerequisites

  • A server running one of the following operating systems: Debian 11 (Bullseye)
  • It’s recommended that you use a fresh OS install to prevent any potential issues
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Wireguard on Debian 11 Bullseye

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade

Step 2. Installing Wireguard on Debian 11.

Now we download the script installation Wireguard from the Github repository:

curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh

Next, make the file downloaded executable and run it:

chmod +x wireguard-install.sh
./wireguard-install.sh

Output:

Install Wireguard on Debian 11

Step 3. Client Configuration.

Once successfully installed and configuring, the script will prompt you for client configuration and it will only do the two things and that is:

Install Wireguard on Debian 11

The rest of the client setup will be done automatically by the script and you should get the result like in the following picture, with the QR code listed for ease of client setup:

Install Wireguard on Debian 11 Bullseye

Next, we download the .ovpn client file (you can use an SSH client with an integrated file manager such as Bitwise.) On Linux you can download the file with SFTP:

sftp remote_user@remote-server-ip-address
get client_config.ovpn

After that, start WireGuard and enable it at boot:

sudo wg-quick up wg0
sudo systemctl start wg-quick@wg0
sudo systemctl enable wg-quick@wg0

To establish the connection from the client to the server, on the client machine, install the Wireguard client and run the following command below to connect:

client sudo wg-quick up client_config.conf

Step 4. Firewall Configuration.

If you are using UFW, you will be required to allow port 51820 through the firewall:

sudo ufw allow ssh
sudo ufw allow 51820/udp

Congratulations! You have successfully installed Wireguard. Thanks for using this tutorial for installing the latest version of the Wireguard VPN server on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official Wireguard website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!