How to Install WireGuard on Ubuntu Server in 10 Minutes

This guide covers how to install WireGuard on Ubuntu server in the fastest way possible, using an automated script instead of manual configuration. WireGuard is a modern VPN protocol built into the Linux kernel. It is lightweight, fast, and much easier to configure than traditional VPN solutions like OpenVPN.

This guide walks through the fastest way to get WireGuard running on an Ubuntu VPS using an automated script instead of building the config by hand.

Before You Start

You’ll need:

  • Ubuntu 20.04 or later, with root access
  • SSH access to the server
  • A public IPv4 address on the VPS (Veeble VPS plans include this by default)

Step 1: Update the Server

Log in over SSH and update everything before installing anything new.

Step 2: Install WireGuard With an Automated Script

You can install WireGuard manually, but getting the iptables NAT rules right so traffic actually reaches the internet is where most manual setups go wrong. It’s faster and more easy to use a well-maintained, open-source install script that handles the network forwarding for you.

The one most people use is maintained by developer angristan on GitHub. Grab it and run it:

Step 3: Answer the Setup Prompts

The script will ask you some questions. The defaults work fine for almost everyone:

  • Public IPv4 address: auto-detected
  • Public network interface: auto-detected, usually eth0 or ens3
  • WireGuard port: 51820 is the standard, no reason to change it
  • DNS resolver: pick one for your clients, 1.1.1.1 (Cloudflare) or 8.8.8.8 (Google) both work well

Just hit Enter through each one unless you have a specific reason not to.

Step 4: Set Up a Mobile Client

As soon as the server setup finishes, it asks you to create your first client.

  1. Give it a name, something like phone
  2. It generates a QR code right there in the terminal
  3. Install the official WireGuard app from the Play Store or App Store
  4. Open the app, tap +, pick Scan from QR code, and point your camera at the screen

That’s it, the device is connected and routing through the server.

Step 5: Set Up a Desktop Client

Desktop needs a config file instead of a QR scan.

  1. Run the script again to bring up the menu:
  1. Pick the option to add a new client
  2. Name it something you’ll recognize later, like desktop
  3. It drops a file like desktop.conf in your current directory
  4. Print it out:
  1. Copy that output into a text file on your computer and save it as desktop.conf
  2. Grab the official WireGuard desktop client for your OS
  3. Open it, choose Import tunnel(s) from file, select desktop.conf, and activate

Confirming It Actually Works

Back on the server, check the interface is up:

If a client has connected, you’ll see a recent handshake timestamp next to it. No handshake usually means your firewall is blocking UDP on port 51820, so check that first.

A Few Things Worth Doing After Setup

  • Only allow the WireGuard port through your firewall for what actually needs it, ufw handles this fine
  • Clean up client profiles you’re not using anymore through the script’s menu
  • Keep the server patched. WireGuard lives in the kernel, so kernel updates matter here more than usual
  • Give every device its own client profile instead of sharing one config around

Conclusion

WireGuard provides a simple and reliable way to create a secure VPN connection to your Ubuntu server. Using the automated installation script makes the setup much quicker while avoiding common networking mistakes. If you’re using a Veeble VPS, you already have the root access and networking required to deploy WireGuard. You can explore our VPS hosting plans if you need a server for secure remote access, private networking, or site administration.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top