wget --no-check-certificate -O /opt/wireguard.sh https://raw.githubusercontent.com/teddysun/across/master/wireguard.sh chmod 755 /opt/wireguard.sh cd /opt export VPN_SERVER_WG_PORT=11660 #指定wg的监听端口,如果不指定将会生成一个随机端口 sh wireguard.sh -r
出现如下提示,说明安装成功
1 2 3 4 5 6 7 8 9 10 11
[Mon Oct 4 10:59:35 CST 2021] WireGuard VPN Server installation completed [Mon Oct 4 10:59:35 CST 2021] [Mon Oct 4 10:59:35 CST 2021] WireGuard VPN default client file is below: [Mon Oct 4 10:59:35 CST 2021] /etc/wireguard/wg0_client [Mon Oct 4 10:59:35 CST 2021] [Mon Oct 4 10:59:35 CST 2021] WireGuard VPN default client QR Code is below: [Mon Oct 4 10:59:35 CST 2021] /etc/wireguard/wg0_client.png [Mon Oct 4 10:59:35 CST 2021] [Mon Oct 4 10:59:35 CST 2021] Download and scan this QR Code with your device [Mon Oct 4 10:59:35 CST 2021] Welcome to visit: https://teddysun.com/554.html [Mon Oct 4 10:59:35 CST 2021] Enjoy it
脚本命令列表如下:
1 2 3 4 5 6 7 8 9 10 11
Usage : wireguard.sh [Options] Options: -h, --help Print this help text and exit -r, --repo Install WireGuard from repository -s, --source Install WireGuard from source -u, --update Upgrade WireGuard from source -v, --version Print WireGuard version if installed -a, --add Add a WireGuard client -d, --del Delete a WireGuard client -l, --list List all WireGuard client's IP -n, --uninstall Uninstall WireGuard
安装后查看wg的状态
1 2 3 4 5 6 7 8 9 10
$ wg show interface: wg0 public key: NuqTrBKdgO79f5oeGRrttKBpEy24eB***** private key: (hidden) listening port: 11660