Files
potatium/scripts/setup_ubuntu26.sh
T

32 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Re-runnable setup for an unprivileged Ubuntu Server 26.04 LTS Proxmox LXC.
set -Eeuo pipefail
if [[ $EUID -ne 0 ]]; then echo 'Run via sudo or as root.' >&2; exit 1; fi
# shellcheck disable=SC1091
source /etc/os-release
if [[ "${ID:-}" != ubuntu || "${VERSION_ID:-}" != "26.04" ]]; then
echo "This script is intended for Ubuntu 26.04 LTS; detected ${PRETTY_NAME:-unknown}. Aborted." >&2
exit 1
fi
if [[ $(uname -m) != x86_64 && $(uname -m) != aarch64 ]]; then
echo 'Use amd64 or arm64 Ubuntu LXC.' >&2; exit 1
fi
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates curl git openssh-server sudo unzip zip \
build-essential make python3 jq tar rsync
if ! id potatium >/dev/null 2>&1; then
adduser --disabled-password --gecos '' potatium
echo 'Created user potatium without password. Set up SSH public key for login.'
fi
usermod -aG sudo potatium
install -d -o potatium -g potatium -m 0755 /home/potatium/src
if command -v systemctl >/dev/null 2>&1; then systemctl enable --now ssh; fi
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
bash "$SCRIPT_DIR/install_go.sh"
echo
printf 'Setup complete. User: potatium | Source dir: /home/potatium/src | Go: '
/usr/local/go/bin/go version
printf 'Next: configure SSH key, unpack ZIP, bash scripts/bootstrap_workdir.sh, bash scripts/doctor.sh.\n'