Skip to content

Commit d11475e

Browse files
committed
Add Amazon Linux support
1 parent 86958c2 commit d11475e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

wireguard-install.sh

+18-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ function checkOS() {
6161
OS=oracle
6262
elif [[ -e /etc/arch-release ]]; then
6363
OS=arch
64+
elif [[ ${ID} == "amzn" ]] || [[ ${ID_LIKE} == *"amzn"* ]]; then
65+
OS=amazon
6466
else
65-
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, AlmaLinux, Oracle or Arch Linux system"
67+
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, AlmaLinux, Oracle, Amazon or Arch Linux system"
6668
exit 1
6769
fi
6870
}
@@ -204,6 +206,19 @@ function installWireGuard() {
204206
dnf install -y wireguard-tools qrencode iptables
205207
elif [[ ${OS} == 'arch' ]]; then
206208
pacman -S --needed --noconfirm wireguard-tools qrencode
209+
elif [[ ${OS} == 'amazon' ]]; then
210+
# Amazon Linux specific installation
211+
yum update -y
212+
amazon-linux-extras install epel -y
213+
yum install -y wireguard-tools iptables qrencode
214+
215+
# Enable WireGuard kernel module
216+
echo "Enabling WireGuard kernel module..."
217+
modprobe wireguard
218+
if ! lsmod | grep -q wireguard; then
219+
echo "Failed to load WireGuard kernel module"
220+
exit 1
221+
fi
207222
fi
208223
209224
# Make sure the directory exists (this does not seem the be the case on fedora)
@@ -458,6 +473,8 @@ function uninstallWg() {
458473
yum remove --noautoremove wireguard-tools qrencode
459474
elif [[ ${OS} == 'arch' ]]; then
460475
pacman -Rs --noconfirm wireguard-tools qrencode
476+
elif [[ ${OS} == 'amazon' ]]; then
477+
yum remove -y --noautoremove wireguard-tools qrencode
461478
fi
462479
463480
rm -rf /etc/wireguard

0 commit comments

Comments
 (0)