#!/bin/bash ############################################################################### # Setup a VM with Watch My Domains SED # # Copyright (C) 2025-2026 CodePunch Solutions - All Rights Reserved # https://codepunch.com/ # # Author: Syam Kumar # Last revised on 25 November 2026 # # This will check the OS version, download the installation script for that OS version, # verify its SHA-256, and run it with Bash. # # The downloaded script will install Apache, PHP, LetsEncrypt, fail2ban, MariaDB etc. # A user 'wmdsed' will be created (password saved to /root/required.txt) # MariaDB root password is also saved to /root/required.txt. Please # delete this file after saving the passwords. # ############################################################################### # For fresh x86-64 Linux servers only. Review the installer before running. set -eu if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" >&2 exit 1 fi if [ "$(uname -m)" != "x86_64" ]; then echo "Unsupported architecture: only x86_64 is supported" >&2 exit 1 fi if [ ! -r /etc/os-release ]; then echo "Unable to identify the operating system." >&2 exit 1 fi # shellcheck source=/dev/null source /etc/os-release INSTALL_URL="https://domainpunch.com/wmd-sed/install/scripts/" case "${ID:-}:${VERSION_ID:-}" in debian:12) SCRIPT_NAME="wmdsed6-debian-12-php-8.2.sh" EXPECTED_SHA256="c3d5f3d92b9d3a753b6c2da798c860c44c1ba57ad6813fb112b56a0d95bfa6f1" ;; debian:13) SCRIPT_NAME="wmdsed6-debian-13-php-8.4.sh" EXPECTED_SHA256="084ad6a322515c4a8e5c421a64dec20870c7f487032fffde0d6e8a3d997f2835" ;; ubuntu:22.04) SCRIPT_NAME="wmdsed6-ubuntu-22.04-php-8.1.sh" EXPECTED_SHA256="1dc96051633e0839175e2938c4c8ba471a976394c8d3b878f8fc67fd4aa19bc5" ;; ubuntu:24.04) SCRIPT_NAME="wmdsed6-ubuntu-24.04-php-8.3.sh" EXPECTED_SHA256="0f73d8bee9f152147e8cf35641589bc3844b0b5dcfab7696ed25164f79931077" ;; ubuntu:26.04) SCRIPT_NAME="wmdsed6-ubuntu-26.04-php-8.5.sh" EXPECTED_SHA256="38a2d7a0935eabaee25283adea1965173a05b1d5a85ec889333eed0e9ee43af2" ;; *) echo "Unsupported OS: ${ID:-unknown} ${VERSION_ID:-unknown}" >&2; exit 1 ;; esac echo "Detected OS: $ID $VERSION_ID" echo "Downloading installation script: $SCRIPT_NAME" workdir=$(mktemp -d) trap 'rm -rf -- "$workdir"' EXIT script="$workdir/$SCRIPT_NAME" if ! wget --https-only "${INSTALL_URL}${SCRIPT_NAME}" -O "$script"; then echo "Failed to download the installation script." >&2 exit 1 fi if ! [ -s "$script" ] || ! printf '%s %s\n' "$EXPECTED_SHA256" "$script" | sha256sum --check --status; then echo "Installation script checksum verification failed." >&2 exit 1 fi if ! bash -n "$script"; then echo "The downloaded installation script contains syntax errors." >&2 exit 1 fi echo "Running installation script..." bash "$script" "$@"