Skip to Main Content

Navigation

How to install WireGuard on your Ubuntu Server

Knowledgebase/VPS/how-to-install-wireguard-on-your-ubuntu-server

WireGuard is one the most popular VPN / traffic proxying applications out there and being so, is very easy to install, here's a simple guide to carry you through the installation & configuration process on Ubuntu 20.04 LTS or higher.

(1) Update & Upgrade Ubuntu Device

Run the following commands in your console:

sudo apt update

&

sudo apt upgrade

(2) Install the WireGuard VPN server

Simply run the following apt command:

sudo apt install wireguard

(3) Configure the WireGuard server

(3.1) Create a private and public key for the WireGuard server by following these instructions:

Enter the /wireguard Directory:

sudo -i
cd /etc/wireguard/

If no /wireguard Directory exists, create it:

mkdir -m 0700 /etc/wireguard/
cd /etc/wireguard/

Now create the keys:

umask 077; wg genkey | tee privatekey | wg pubkey > publickey

If you want to view the keys run these commands:

ls -l privatekey publickey
cat privatekey
cat publickey

Make sure to store the privatekey safely but where you are able to find it again.

(3.2) Edit the wg0.conf

Start by loading the wg0.conf file:

sudo nano /etc/wireguard/wg0.conf

And make the config changes:

Address = 192.168.6.1/24 (Your VPN server private IP)
 
ListenPort = 41194 (The port you want wireguard to listen on)
 
PrivateKey = EXAMPLE (your WireGuard privatekey)

(4) Configure firewalling for WireGuard on your server:

(4.1) Open the required port

On your KUBBUR Cloud / VPS control panel, enter the "FIREWALL" tab and press "NEW RULE", for this modal to show up:

Enter the "FIREWALL" page

Enter in any name that you'd like, the Source IP (IP connections are coming from, leave blank for no restrictions), Destination IP (the IP of where your WG server is runnung, in this case it's your VPS IP), Protocol to 'UDP', Source Port (similar to Source IP but the restriction on ports, and the Destination Port (The port in your wireguard config).

(4.2) Apply Wireguard ddos protection filter

Go to back to your KUBBUR "FIREWALL" page and press "FILTERS" for this modal, or similar, to show:

Fill in the details of your WireGuard config and your WireGuard VPN is now a highly DDoS Protected server!

(5) Start WireGuard

To start the WireGuard service run:

sudo systemctl start [email protected]

To make WireGuard service boot on startup run:

sudo systemctl enable [email protected]

And that's how to install WireGuard onto your Ubuntu 20.04 LTS Server.

Need more help?

Speak to our support team to help you with your problem!

let's talk!
KUBBUR Logo

Made with ❤️ in Iceland

Copyright © 2021 - 2022 KUBBUR Limited. All rights reserved. KUBBUR is a brand of KUBBUR Limited, a duly registered company of England and Wales. Company no. 13999809. ICO no. ZB331924.

Minecraft® is a registered trademark of Mojang AB. This website is not affiliated with or endorsed by Mojang AB. Discord®, the Discord® logo and Discord Nitro® are registered trademarks of Discord, Inc. Ubuntu®, Kubuntu®, Lubuntu®, Xubuntu®, Canonical®, the Ubuntu® logo and the "Circle of Friends®" are registered trademarks of Canonical, Ltd. Intel®, and the Intel® logo are registered trademarks of Intel Corporation and its subsidiaries. AMD®, AMD Ryzen®, the AMD® and AMD® arrow logo, AMD EPYC®, and the AMD Ryzen® logo are registered trademarks of Advanced Micro Devices, Inc. Apex Hosting® is a registered trademark of Apex Hosting, LLC. MCProHosting® is a registered trademark of MCProHosting, LLC. PebbleHost® is a registered trademark of Daniel James Jackson.

All product names, brands, logos, trademarks and registered trademarks are property of their respective owners. Any use of the aforementioned on this website is for identification purposes only and does not imply endorsement.

KUBBUR Limited is a subsidiary of KVM Group Limited and Scaleblade, Ltd. of the United Kingdom.