WireGuard on Ubuntu / Debian CLI

WireGuard® is a modern VPN protocol for secure and fast data transfer over the internet.

Before installation, make sure that:

• This guide demonstrates the setup process on Ubuntu 24.04 and Debian 12 without a GUI. On earlier versions, some steps may differ, while on newer versions they typically remain the same.
• You have a WireGuard configuration file in .conf format from your Personal Area (in our example, the configuration file Lithuania.conf will be used).

1. Update the package list and install WireGuard:

sudo apt update
sudo apt install -y wireguard openresolv

2. Create a directory for WireGuard configurations (if it doesn’t already exist):

sudo mkdir -p /etc/wireguard

3. Copy your .conf file into this directory:

sudo cp ~/Downloads/Lithuania.conf /etc/wireguard/

4. WireGuard requires that the configuration file be owned by root and have restricted permissions:

sudo chmod 600 /etc/wireguard/Lithuania.conf

5. To connect, run:

sudo wg-quick up Lithuania

To disconnect the VPN, run:

sudo wg-quick down Lithuania