Installing PiVPN with WireGuard on Ubuntu Server

This guide provides step-by-step instructions to install PiVPN using the WireGuard protocol on an Ubuntu Server system. PiVPN simplifies the process of setting up a secure and private VPN server.


System Requirements


1. Update the System

sudo apt update && sudo apt upgrade -y

2. Set a Static IP Address (if not already set)

Edit your netplan configuration file:

sudo nano /etc/netplan/00-installer-config.yaml

Example configuration:

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses: [1.1.1.1, 8.8.8.8]

Apply the changes:

sudo netplan apply

3. Install PiVPN

Run the automated installation script:

curl -L https://install.pivpn.io | bash

During installation:


4. Configure WireGuard Profiles

To add a new VPN client:

pivpn add

Enter a name when prompted. This creates a .conf file stored in:

/home/<user>/configs/

To display a QR code for mobile devices:

pivpn -qr

5. Configure Router Port Forwarding

Log in to your router and forward the selected WireGuard port (e.g., 51820/UDP) to your Ubuntu Server's static IP address.


6. Connect Client Devices


7. Common PiVPN Commands

pivpn -c
pivpn -l
pivpn revoke
pivpn update

Conclusion

You now have a secure WireGuard VPN running on Ubuntu Server using PiVPN. Connect remotely, enhance privacy, and safely route your traffic through your home network. Regularly check for updates to keep your VPN secure and performant.


Revision #3
Created 4 May 2025 21:55:29 by Art
Updated 4 June 2025 23:32:00 by Art