How To Setup WireGuard on Ubuntu

Install WireGuard

  1. Open a terminal window.
  2. Run the following command to update your package list:
    sudo apt update
  3. Install WireGuard with:
    sudo apt install wireguard

Download VPN Profile

  1. Go to the VPN panel login page and log in using your VPN username and password. After logging in, you can download your WireGuard configuration file.
  2. Navigate to the WireGuard section and download the configuration file for your desired server.
  3. If you do not have a configuration file, you can create one by clicking on "Add WireGuard Server" and following the instructions to generate a new configuration file.

Import WireGuard Configuration

  1. Unzip the downloaded file (replace yourfile.zip with the actual filename):
    unzip ~/Downloads/yourfile.zip -d ~/Downloads/wgconf
  2. Find the extracted .conf file (the name may vary), then copy its contents to /etc/wireguard/wg0.conf:
    sudo cp ~/Downloads/wgconf/*.conf /etc/wireguard/wg0.conf
  3. Set the correct permissions:
    sudo chmod 600 /etc/wireguard/wg0.conf

Connect to the VPN Server

  1. Start WireGuard with:
    sudo wg-quick up wg0

Verify Connection

  1. Check the connection status:
    sudo wg

Disconnecting from VPN

  1. To disconnect, run:
    sudo wg-quick down wg0