Easily Install WireGuard VPN on Ubuntu 22/24 with One Command

StackCP Lifetime Linux Hosting Dashboard

Looking for a fast and secure way to install WireGuard VPN on your server? This fully automated script will have your VPN up and running in seconds — with client config and management tools ready to go. Works perfectly on Ubuntu 22.04 and Ubuntu 24.04.


✅ What Is WireGuard?

WireGuard is a next-gen VPN protocol that’s fast, secure, and lightweight. It’s easier to configure than OpenVPN and performs better than IPSec — all while being natively supported in modern Linux kernels.


⚡ Script Features

  • ✔️ One-command install for Ubuntu 22.04 & 24.04
  • 🔄 Auto NAT & IP forwarding with interface detection
  • 🔑 Server key generation and client ready-to-use
  • 📂 Saves client config to /root/client1.conf
  • 📱 Optional QR code generation for mobile WireGuard apps
  • 🛠 Includes management tools in /root/wireguard/:
    • add-client.sh – Add new clients
    • remove-client.sh – Remove clients safely
    • list-clients.sh – View existing clients
    • restart-wireguard.sh – Restart VPN service
    • uninstall-wireguard.sh – Full removal

🚀 One-Line Install Command

wget -O wireguard-vpn.sh https://cdn.xhosts.uk/scripts/wireguard-vpn.sh && chmod +x wireguard-vpn.sh && ./wireguard-vpn.sh

💬 During setup, you’ll be asked if you want QR code support for quick mobile configuration. Say “yes” to enable it!


📂 After Installation

  • Client config saved to: /root/client1.conf
  • Use with any desktop or mobile WireGuard app
  • Tools available in: /root/wireguard/

To add more clients later, just run:

cd /root/wireguard
./add-client.sh

📱 Use on Your Mobile Device

If you enabled QR code support during install, you’ll see a QR code that can be scanned directly with the WireGuard app for iOS or Android — no manual setup required!


💬 Feedback & Suggestions

We’re actively building tools like this to make server management easier. If you have feedback or suggestions, please share them with us via our Discord community.


🧠 Final Thoughts

This script gives you everything you need to get a secure, production-ready VPN setup on your server in minutes — with none of the manual config headaches.

Built by admins, for admins. Try it today!


Leave a Reply

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

© 2016-2025 xHosts UK All Rights Reserved.

xHosts UK is a brand of Low Cost Web Solutions Limited | Company Number: 14338891