WireGuard autoinstaller written in Bash
WireGuard road warrior installer for Debian 9, CentOS 7 and Ubuntu 18.04 LTS!
This script will install automatically the Wireguard server and generate client configuration files for a secure connection.
wget https://raw.githubusercontent.com/l-n-s/wireguard-install/master/wireguard-install.sh -O wireguard-install.sh
bash wireguard-install.sh
Once it finishes, you can run it again to generate more users. Reboot your server to apply all settings.
The script can be configured by setting the following environment variables:
- INTERACTIVE - if set to "no", the script will not prompt for user input
- PRIVATE_SUBNET - private subnet configuration, "10.9.0.0/24" by default
- SERVER_HOST - public IP address, detected by default
- SERVER_PORT - listening port, picked random by default
- CLIENT_DNS - comma serparated DNS servers to use by the client
Copy the file /root/client-wg0.conf
from a remote server to your local PC path /etc/wireguard/wg0.conf
and run
sudo systemctl start wg-quick@wg0.service
or you can use the QR code generated by this script to auto-add mobile clients.
To show VPN status, run wg show
.