angristan / wireguard-install

WireGuard VPN installer for Linux servers
https://stanislas.blog/2019/01/how-to-setup-vpn-server-wireguard-nat-ipv6/
MIT License
8.02k stars 1.31k forks source link

Script does not install until I install these "Dependencies" first #160

Closed ishmumx closed 1 year ago

ishmumx commented 3 years ago

I have been using this script for a long time. However, if I try to run the script on a fresh system, it never works.

Without fail, I have been using my personal documentation to install this on many systems. I'd like to share it here and ask a question: Why does it need all of these things before installing? Why does the script not work as is? Thanks.

Run the following before installing WireGuard onto a Debian or Ubuntu system

apt-get update

apt-get install linux-image-amd64 linux-headers-amd64 -y && reboot

apt-get update && apt-get --fix-missing upgrade -y && apt-get --with-new-pkgs upgrade -y && apt-get update && apt-get install curl git libmnl-dev libelf-dev linux-headers-$(uname -r) build-essential pkg-config lsb-release iptables libmnl-dev libelf-dev linux-headers-$(uname -r) build-essential pkg-config libmnl-dev libelf-dev linux-headers-$(uname -r) build-essential pkg-config -y && apt-get update && apt-get --fix-missing upgrade -y && apt-get --with-new-pkgs upgrade -y && apt-get autoremove && apt-get clean && reboot

Angristan Script

curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh && chmod +x wireguard-install.sh && ./wireguard-install.sh

angristan commented 3 years ago

The script should install everything it needs. If there is a missing a dependency, please tell use which one. 🙂

nestorwheelock commented 3 years ago

Thanks for sharing. I'm going to add your notes to my repo. I appreciate the time/annoyance-saver here.

I'm working on a fork to get it to run on FreeBSD and I noticed there would be missing prerequisites too on a fresh system. I have my own prep.sh to install curl, git, sudo, devel headers, etc..etc..that usually solves most of those issues so I don't notice it failing like you said when I first ran the script here on non-fresh Ubuntu server image.

I noticed what you point out more when I was messing around with the function to get server's public IP and the NIC and delt with the what ifs of my environment when there are several to choose from or multi-homed system. Hopefully a *nix admin already knows their network particulars ahead of time to type them in. However, curl was blatantly obviously missing when I started with a fresh FreeBSD system and thought to skin the cat like this instead in case anyone's curious:

SERVER_PUB_IP=$(curl -s https://api.ipify.org)
SERVER_NIC=$(ifconfig | grep -B4 "${SERVER_PUB_IP}" | grep "flags"  | awk '{ FS=":" } { print $1 }')

I guess looking at the routing table would be another messy way to try to figure it out. IPv6 doesn't really work still for a lot of ISP customers, and a self-hosted local office server for instance would likely only be IPv4 for the foreseeable future. In that future iteration I'll worry more about it. For now though the script is helpful and I appreciate everyone's work to make my job easier.

Thanks! -Nestor