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.
sudo apt update && sudo apt upgrade -y
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:
curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
chmod +x wireguard-install.sh
sudo ./wireguard-install.sh
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
eth0orens3 - WireGuard port:
51820is the standard, no reason to change it - DNS resolver: pick one for your clients,
1.1.1.1(Cloudflare) or8.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.
- Give it a name, something like
phone - It generates a QR code right there in the terminal
- Install the official WireGuard app from the Play Store or App Store
- 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.
- Run the script again to bring up the menu:
sudo ./wireguard-install.sh
- Pick the option to add a new client
- Name it something you’ll recognize later, like
desktop - It drops a file like
desktop.confin your current directory - Print it out:
cat desktop.conf
- Copy that output into a text file on your computer and save it as
desktop.conf - Grab the official WireGuard desktop client for your OS
- 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:
sudo wg show
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,
ufwhandles 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.