Introduction
You can very easily set up a Wireguard server, using docker (for docker-compose accuracy) on your Linux server. This option may also work on Windows, however I am not testing it
Requirements
- Linux Server (with root access)
- Ability to open ports
-
docker&docker-composeinstalled
Before you start...
Please open ports 51820 (UDP), otherwise it won't work
Installation process
- Enter these two commands, they will create required directories
mkdir -p ~/wireguard/
mkdir -p ~/wireguard/config/
- Run
nano ~/wireguard/docker-compose.ymland paste below-mentioned content into thedocker-compose.ymlfile
version: '3.8'
services:
wireguard:
container_name: wireguard
image: linuxserver/wireguard
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Warsaw
- SERVERURL=00.00.00.00
- SERVERPORT=51820
- PEERS=10
- PEERDNS=auto
- INTERNAL_SUBNET=10.0.0.0
ports:
- 51820:51820/udp
volumes:
- type: bind
source: ./config/
target: /config/
- type: bind
source: /lib/modules
target: /lib/modules
restart: always
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
Fill this config:
-
TZis a Timezone - Get yours from TZ Database in Wikipedia -
SERVERURLis your server IP -
PEERSare basically configs, if you want 10 configs, just type 10, and peers will generate automaticly
Hit CTRL + X and then Y then ENTER to save the file
To run Wireguard enter these two commands:
cd ~/wireguard/
docker-compose up -d
- Enter
docker-compose logs -f wireguard- There should be QR codes, with connection profiles - Or go to
~/wireguard/config/to see.conffiles for every peer.
Enjoy your fresh & private VPN
Top comments (0)