How to Set Up a WireGuard VPN on Your VPS

Running your own VPN on a VPS gives you a private, encrypted connection that you fully control – no third-party logs, and an exit point in the region you choose. WireGuard is modern, fast and simple to set up.

Install WireGuard

Connect over SSH and install it with sudo apt update && sudo apt install wireguard. WireGuard is built into modern Linux kernels, so there’s very little overhead.

Configure the server and a client

  • Generate server and client key pairs with wg genkey
  • Create /etc/wireguard/wg0.conf with your server keys and address range
  • Enable IP forwarding and start it: sudo wg-quick up wg0
  • Add each device as a peer, or use a helper script like wireguard-install

Open the VPN port

Add a firewall rule for WireGuard’s UDP port (default 51820) in the VPS Firewall tab, then import the client config onto your phone or laptop.

JetHost Experts Tip

A quick, well-maintained shortcut is the community wireguard-install script, which generates the server config and client files for you in a couple of minutes. Prefer OpenVPN? The same VPS handles it just as well.

Need More Help?

Your own WireGuard VPS gives you a private, fast connection wherever you are. If you get stuck, the JetHost team is available 24/7 and usually answers in under five minutes – just contact us and we’ll help you sort it out. Explore our other VPS tutorials to get the most out of your server.