How to Install WireGuard on Debian Latest

WireGuard is a secure and fast VPN tunnel protocol. In this tutorial, we will guide you through the process of installing WireGuard on Debian latest.

Prerequisites

Make sure that the following prerequisites are met before you start with the installation process:

Step-by-Step Guide

Step 1: Update Package List

Before installing the WireGuard package, make sure to update your system's package list:

sudo apt update

Step 2: Install WireGuard

Debian latest already has WireGuard included in its repositories, so you can install it by running the following command:

sudo apt install wireguard

Step 3: Check the WireGuard Installation

After the installation is complete, you can now check the version of WireGuard by running the following command:

sudo modinfo wireguard

Step 4: Generate Server and Client Keys

After installing WireGuard, you can now generate the server and client private and public keys. You can do this by running the following command:

wg genkey | tee privatekey | wg pubkey > publickey

Make sure to replace privatekey and publickey with your required file names.

Note: Make sure to keep the server private key protected and shared only with authorized clients.

Step 5: Configure the WireGuard Interface

Now you have to configure the WireGuard interface by creating a configuration file. You can do this by creating a file with .conf extension in the /etc/wireguard/ directory. Here is an example configuration file:

[Interface]
PrivateKey = <Server Private Key>
Address = 10.0.0.1/24
ListenPort = 51820

[Peer]
PublicKey = <Client Public Key>
AllowedIPs = 10.0.0.2/32

Make sure to replace <Server Private Key> and <Client Public Key> with your generated keys.

Step 6: Start and Enable WireGuard

Now you can start and enable WireGuard by running the following command:

sudo systemctl start wg-quick@<configuration-file-name>
sudo systemctl enable wg-quick@<configuration-file-name>

Make sure to replace <configuration-file-name> with your filename with .conf extension.

Step 7: Verify the WireGuard Connection

To verify the WireGuard connection, you can run the following command:

sudo wg

If everything is configured correctly, you should see the information regarding the WireGuard interface.

Congratulations, you have now successfully installed and configured WireGuard on Debian latest!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!