Install WireGuard on Linux (CLI)
Choose your distribution below
More supported distros can be found on the official installation instructions.
azirevpn-wg script (recommended)
-
Install WireGuard
sudo add-apt-repository ppa:wireguard/wireguard sudo apt-get update sudo apt-get install wireguard jq resolvconf
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable apt update apt install wireguard jq resolvconf
pkg install wireguard
emerge wireguard
apk add -U wireguard-tools
sudo pacman -S wireguard-dkms wireguard-tools
sudo dnf copr enable jdoss/wireguard sudo dnf install wireguard-dkms wireguard-tools
xbps-install -S wireguard
-
Run our configuration script and enter your username and password when prompted
curl -LO https://www.azirevpn.com/dl/azirevpn-wg.sh && chmod +x ./azirevpn-wg.sh && ./azirevpn-wg.sh
-
Turn on WireGuard
wg-quick up azirevpn-se1
-
Turn off WireGuard
wg-quick down azirevpn-se1
Manual Configuration without Script
If you for some reason do not want to use our script which create a configuration file for you then this guide is for you.
-
Install WireGuard by following the official instructions
sudo add-apt-repository ppa:wireguard/wireguard sudo apt-get update sudo apt-get install wireguard
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable apt update apt install wireguard
pkg install wireguard
emerge wireguard
apk add -U wireguard-tools
sudo pacman -S wireguard-dkms wireguard-tools
sudo dnf copr enable jdoss/wireguard sudo dnf install wireguard-dkms wireguard-tools
xbps-install -S wireguard
-
We will start by using the wg(8) tool to generate private and public keys as seen in the example below.
AzireVPN conf file
wg genkey | tee privatekey | wg pubkey > publickey cat privatekey 65G7oyb9jGxFXSCceTuFPHjjbPF2WVOCeNJ1SgPzzWk= cat publickey oP4Hdje7viyO+6Hz6QKQgHqD55w+Km9uZ0shmTFU0GI=
-
You are now ready to authenticate to our service by sending your login credentials and public key. As seen in the example below, we use curl to post the data to our WireGuard server in Stockholm (se1).
API request
curl -d username=REPLACE --data-urlencode password=REPLACE --data-urlencode pubkey=REPLACE https://api.azirevpn.com/v1/wireguard/connect/se1 { "status": "success", "data": { "DNS": "193.180.164.2, 2a03:8600:1001::2", "Address": "10.18.1.182/24, 2a03:8600:1001:1080::10b4/64", "PublicKey": "bdR5gm5vcrm9N9I7BeQqHOgrmQApSGIe9qc1homBjk8=", "Endpoint": "193.180.164.60:51820" } }
-
Now that our service has your public key we can begin to setup the interface on your computer. In this guide we'll be using the utility wg-quick(8) to help us setup our interface.
Let's start by creating a configuration file in /etc/wireguard/ folder. Name it azirevpn-se1.conf and include the example below but replace the data with the one you got in our curl response.
/etc/wireguard/azirevpn-se1.conf example file
[Interface] PrivateKey = 65G7oyb9jGxFXSCceTuFPHjjbPF2WVOCeNJ1SgPzzWk= DNS = 193.180.164.2, 2a03:8600:1001::2 Address = 10.18.1.182/24, 2a03:8600:1001:1080::10b4/64 [Peer] PublicKey = bdR5gm5vcrm9N9I7BeQqHOgrmQApSGIe9qc1homBjk8= Endpoint = 193.180.164.60:51820 AllowedIPs = 0.0.0.0/0, ::/0
-
Turn on WireGuard
wg-quick up azirevpn-se1
-
Turn off WireGuard
wg-quick down azirevpn-se1