Skip to content

WireGuard – Installation and setup on your own server

Secure installation of WireGuard VPN on a VPS: simple setup, traffic encryption and a stable connection. Instructions for Linux and other OSes.

WireGuard – Installation and setup on your own server

WireGuard is a modern solution for creating secure virtual private networks (VPN). It is an easy-to-use, fast and reliable tool that provides a high level of security when transferring data. WireGuard uses advanced cryptographic protocols and algorithms to protect your connection, making it one of the most secure VPN options available today.


System requirements

INFO

This guide uses the Ubuntu 20.04 OS. Recommended technical specifications:

  • CPU: 1 vCore
  • RAM: 512 MB
  • Storage: 1 GB
  • Network speed: 100Mbps+

This information is for reference, since any available virtual server plan will do for using WireGuard VPN.


Installation process

Preparing the server

  1. Connect to your server via SSH.
  2. Update the list of system packages and repositories:
bash
apt-get update
  1. Install Curl, if it is missing:
bash
apt-get install curl -y

Installing Docker

Use the following command to install Docker automatically:

bash
curl -sSL https://get.docker.com | sh

The process will take about 1 minute, depending on the network speed and server performance.


Installing WireGuard

After Docker has been installed successfully, use the following template, replacing the variables with your own values:

bash
docker run -d \
  --name=wg-easy \
  -e WG_HOST=🚀YOUR_SERVER_IP \
  -e PASSWORD=🚀YOUR_ADMIN_PASSWORD \
  -v ~/.wg-easy:/etc/wireguard \
  -p 51820:51820/udp \
  -p 51821:51821/tcp \
  --cap-add=NET_ADMIN \
  --cap-add=SYS_MODULE \
  --sysctl="net.ipv4.conf.all.src_valid_mark=1" \
  --sysctl="net.ipv4.ip_forward=1" \
  --restart unless-stopped \
  weejewel/wg-easy

Where:

  • 🚀YOUR_SERVER_IP – the IP address of your server
  • 🚀YOUR_ADMIN_PASSWORD – the password for accessing the web control panel

Important: Use only letters and numbers in the password. Special characters may cause errors when the script runs.

Example of a correct password: QJQcc7cAdTY85sp7

Example of an incorrect password: u>N#uG_3Z=5pS'cn;


Configuring WireGuard

Access to the web panel

After a successful installation, open http://IP:51821 in your browser, where IP – the address of your server. Enter the password you set during installation.

Creating a user

  1. In the web interface, click the "New Client" button.
  2. Enter a username and click "Create".

Connecting to the VPN

Method 1: Using a configuration file

  1. Click the download button next to the created user to get the configuration file (.conf).
  2. Download the official WireGuard client for your operating system.
  3. Import the downloaded file into the WireGuard client.
  4. Activate the tunnel.

Method 2: Scanning a QR code

  1. Click the QR code button next to the user.
  2. Install the official WireGuard app on your mobile device.
  3. In the app, select the option to scan a QR code.
  4. Scan the code displayed in the web interface.
  5. Activate the connection.

Monitoring

The WireGuard web interface lets you track user activity and the amount of traffic consumed in real time. The connection status and current activity are displayed for each user.

WireGuard provides reliable protection of your data with minimal resource usage, which makes it an ideal choice for creating secure connections between devices and protecting your internet traffic from prying eyes.


Our resources

Telegram channel: https://t.me/
F3 Cloud: https://f3cloud.com

F3 Cloud Knowledge Base