How to Set Up WireGuard VPN on a Swedish VPS

Run Your Own VPN Server with WireGuard

Instead of paying for a commercial VPN service, run your own WireGuard server on a VPS. You get full control, no third-party logs, and a dedicated Swedish IP address.

What You Need

  • A VPS with Linux โ€” KVM VPS 1G (โ‚ฌ6/month) is plenty
  • Root access (SSH)
  • 10 minutes of your time

Order KVM VPS 1G โ†’

Step 1: Connect to Your VPS

ssh root@your-server-ip

Step 2: Install WireGuard

Debian/Ubuntu

apt update && apt install -y wireguard

Rocky Linux/AlmaLinux

dnf install -y epel-release && dnf install -y wireguard-tools

Step 3: Generate Keys

wg genkey | tee /etc/wireguard/server_private.key | wg pubkey > /etc/wireguard/server_public.key
chmod 600 /etc/wireguard/server_private.key

wg genkey | tee /etc/wireguard/client_private.key | wg pubkey > /etc/wireguard/client_public.key

Step 4: Server Configuration

cat > /etc/wireguard/wg0.conf << EOF
[Interface]
PrivateKey = $(cat /etc/wireguard/server_private.key)
Address = 10.0.0.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey = $(cat /etc/wireguard/client_public.key)
AllowedIPs = 10.0.0.2/32
EOF

Step 5: Enable IP Forwarding

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p

Step 6: Start WireGuard

systemctl enable --now wg-quick@wg0

Step 7: Client Configuration

Create client.conf:

[Interface]
PrivateKey = CLIENT_PRIVATE_KEY
Address = 10.0.0.2/24
DNS = 1.1.1.1

[Peer]
PublicKey = SERVER_PUBLIC_KEY
Endpoint = YOUR_SERVER_IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25

Replace the placeholder values with your actual keys and server IP.

Step 8: Connect

Import the config file into the WireGuard app on your device:

  • Windows/macOS/Linux: wireguard.com/install
  • iOS: App Store โ†’ WireGuard
  • Android: Play Store โ†’ WireGuard

Verify

curl ifconfig.me

Your IP should now show your VPS server’s Swedish IP address.

Why Your Own VPN Is Better

Self-hosted VPNCommercial VPN
Costโ‚ฌ6/monthโ‚ฌ5-10/month
IP addressDedicated (yours only)Shared with thousands
LoggingYou control itTrust the provider
DevicesUnlimitedUsually 5-6
Blocked by servicesRarelyOften
SpeedFull VPS bandwidthVariable
PlanRAMDiskPriceCapacity
KVM VPS 1G1 GB15 GB SSDโ‚ฌ6/month5-10 devices
KVM VPS 2G2 GB20 GB SSDโ‚ฌ10/month20+ devices

Order VPS and set up your VPN โ†’