From 31d94ebb4cd56be8e2fc99cde49a0199ab13de9e Mon Sep 17 00:00:00 2001 From: Nicholas Archuletta <64152648+NichArchA82@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:01:10 -0700 Subject: [PATCH] feat: add server libvirt install script for debian servers --- install-server.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 install-server.sh diff --git a/install-server.sh b/install-server.sh new file mode 100644 index 0000000..31e145e --- /dev/null +++ b/install-server.sh @@ -0,0 +1,76 @@ +#!/bin/bash +set -e + +echo -e "\n\nEverything is now getting setup. This process will take a few minutes...\n\n" + +sudo apt update && sudo apt install gpg jq -y && sudo apt clean + +#remove unattended upgrades +sudo apt-get remove --purge unattended-upgrades || true + +#Install tailscale +curl -fsSL https://tailscale.com/install.sh | sh + +#Install nix package manager +sh <(curl -L https://nixos.org/nix/install) --daemon --yes + +# Load the Nix environment +. /etc/profile.d/nix.sh + +# Install packages from a pinned version of Nixpkgs +nix-env -iA \ + -f https://github.com/NixOS/nixpkgs/archive/53f3c92b4d1f5f297258954c5026e39c45afd180.tar.gz \ + libvirt qemu bridge-utils virt-manager dnsmasq + +# Find the Nix-installed dnsmasq binary +DNSMASQ_BIN=$(which dnsmasq) +LIBVIRTD_BIN=$(which libvirtd) + + +if [[ -z "$DNSMASQ_BIN" || -z "$LIBVIRTD_BIN" ]]; then + echo "Error: One or both binaries (dnsmasq, libvirtd) not found after installation!" + exit 1 +fi + +# Create a systemd service for dnsmasq +echo "Creating systemd service for dnsmasq..." +sudo bash -c "cat > /etc/systemd/system/dnsmasq-nix.service" < /etc/systemd/system/libvirtd-nix.service" <