#!/bin/bash # Install Tailscale on server2 # This script will detect the OS and install Tailscale accordingly echo "=== Installing Tailscale on server2 ===" echo "" # Detect OS and install Tailscale echo "Detecting OS and installing Tailscale..." ssh server2 << 'EOF' # Detect OS if [ -f /etc/os-release ]; then . /etc/os-release OS=$ID VER=$VERSION_ID else echo "Cannot detect OS. Assuming Ubuntu/Debian." OS="ubuntu" fi echo "Detected OS: $OS $VER" echo "" # Install Tailscale based on OS case $OS in ubuntu|debian) echo "Installing Tailscale on Ubuntu/Debian..." curl -fsSL https://tailscale.com/install.sh | sh ;; fedora|rhel|centos|rocky|almalinux) echo "Installing Tailscale on RHEL/CentOS/Fedora..." curl -fsSL https://tailscale.com/install.sh | sh ;; arch|manjaro) echo "Installing Tailscale on Arch Linux..." curl -fsSL https://tailscale.com/install.sh | sh ;; *) echo "Using generic Linux installation..." curl -fsSL https://tailscale.com/install.sh | sh ;; esac echo "" echo "Tailscale installation complete!" echo "" echo "Next steps:" echo "1. Run: sudo tailscale up" echo "2. Follow the authentication link to connect this machine to your Tailscale network" echo "" echo "To check status: sudo tailscale status" EOF echo "" echo "=== Installation script completed ===" echo "" echo "To authenticate and start Tailscale, run:" echo " ssh server2 'sudo tailscale up'" echo "" echo "This will provide a URL to authenticate the device."