Skip to content

Instantly share code, notes, and snippets.

@GhaziTriki
Last active October 21, 2025 15:34
Show Gist options
  • Select an option

  • Save GhaziTriki/b871d27354f42650eb72fbd40a92ffa6 to your computer and use it in GitHub Desktop.

Select an option

Save GhaziTriki/b871d27354f42650eb72fbd40a92ffa6 to your computer and use it in GitHub Desktop.
Force update netbird service for Ubuntu
#!/bin/bash
set -euo pipefail
KEYRING="/usr/share/keyrings/netbird-archive-keyring.gpg"
TMP="$(mktemp)"
echo "Updating package lists..."
sudo apt-get update
echo "Installing prerequisites..."
sudo apt-get install -y ca-certificates curl gnupg
echo "Fetching & converting NetBird GPG key (atomic replace)..."
curl -sSL https://pkgs.netbird.io/debian/public.key \
| gpg --dearmor --batch --yes -o "$TMP"
# Move into place atomically with correct perms/owner
sudo install -m 0644 -o root -g root "$TMP" "$KEYRING"
rm -f "$TMP"
echo "Adding NetBird repository..."
echo 'deb [signed-by=/usr/share/keyrings/netbird-archive-keyring.gpg] https://pkgs.netbird.io/debian stable main' \
| sudo tee /etc/apt/sources.list.d/netbird.list > /dev/null
echo "Refreshing package lists..."
sudo apt-get update
echo "Installing NetBird..."
sudo apt-get install -y netbird
echo "NetBird installation completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment