LibraHostDocumentation

Documentation

Complete guides for all our hosting services

🔐 WireGuard VPN Installation#

This guide explains how to install and configure a WireGuard VPN server on your Linux VPS.

📋 Prerequisites#

  • Linux VPS with root access (Ubuntu/Debian recommended)
  • SSH connection to the server
  • Port 51820 (UDP) open in firewall

📥 Installation Script Download#

Step 1: Download the automated script#

We will use Angristan's automatic installation script which greatly simplifies the process:

curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh chmod +x wireguard-install.sh

Step 2: Launch the installation#

Execute the installation script:

./wireguard-install.sh

⚙️ Server Configuration#

Step 3: Parameter configuration#

The script will ask for several configuration details:

Recommended settings:

  • IPv4 or IPv6: Leave the automatically detected default values
  • Public interface: Usually eth0 (automatically detected)
  • WireGuard port: 51820 (default port, recommended)
  • First DNS server: 1.1.1.1 (Cloudflare) or 8.8.8.8 (Google)
  • Second DNS server: 1.0.0.1 (Cloudflare) or 8.8.4.4 (Google)

💡 Tip: You can leave all parameters as default by simply pressing Enter for each question.

Step 4: Launch installation#

Once all parameters are configured, you will see:

Press any key to continue...

Press Enter to start the WireGuard server installation.

👤 Client Creation#

Step 5: First client configuration#

The script will then ask you to create a first client:

  • Client name: Choose a descriptive name (e.g., my-phone, personal-laptop)
  • The script will automatically generate keys and configuration

Step 6: Configuration retrieval#

Once installation is complete, you will get:

  1. Configuration file: Stored in /root/wg0-client-[name].conf
  2. QR Code: Displayed directly in the terminal for easy mobile configuration

📱 Mobile: Simply scan the QR code with the WireGuard app 💻 Computer: Download the .conf file and import it into WireGuard

📱 WireGuard Client Installation#

On Android/iOS#

  1. Download the WireGuard app from Play Store or App Store
  2. Open the app and tap "+"
  3. Select "Create from QR code"
  4. Scan the QR code displayed in your terminal

On Windows/macOS/Linux#

  1. Download WireGuard from wireguard.com
  2. Install the application
  3. Import the .conf configuration file
  4. Activate the connection

🔧 Client Management#

Add a new client#

To add other clients, simply rerun the script:

./wireguard-install.sh

The script will detect that WireGuard is already installed and offer you to:

  • Add a new client
  • Remove an existing client
  • Uninstall WireGuard

Remove a client#

  1. Rerun the installation script
  2. Choose the "Remove an existing client" option
  3. Select the client to remove

✅ Operation Verification#

Connection test#

To verify your VPN is working:

  1. Connect to the VPN from your device
  2. Check your IP: Visit whatismyipaddress.com
  3. The displayed IP should be your VPS IP

Service verification#

On the server, verify WireGuard is running:

sudo systemctl status wg-quick@wg0 sudo wg show

🔧 Troubleshooting#

Connection issues#

  • Blocked port: Check that port 51820/UDP is open
  • DNS: Try changing DNS servers in configuration
  • Firewall: Check firewall rules on both server and client side

Debug logs#

Check logs if you encounter issues:

sudo journalctl -u wg-quick@wg0 -f