Files
blog/install-hugo.sh

52 lines
1.3 KiB
Bash

#!/bin/bash
# Install Hugo Extended on Ubuntu LXC container
# Run as root or with sudo
set -e
echo "Installing Hugo Extended on Ubuntu..."
# Check current Hugo version
if command -v hugo &> /dev/null; then
echo "Current Hugo version:"
hugo version
fi
# Remove old Hugo from apt if installed
echo "Removing old Hugo installation..."
apt remove -y hugo 2>/dev/null || true
# Add Hugo APT repository
echo "Adding Hugo APT repository..."
ARCH=$(dpkg --print-architecture)
echo "deb [arch=${ARCH} signed-by=/etc/apt/keyrings/hugo.gpg] https://hugo-apt.8hob.io latest main" | tee /etc/apt/sources.list.d/hugo.list
chmod 644 /etc/apt/sources.list.d/hugo.list
# Add signing key
mkdir -p /etc/apt/keyrings
wget -O /etc/apt/keyrings/hugo.gpg https://hugo-apt.8hob.io/signing-key
chmod 644 /etc/apt/keyrings/hugo.gpg
# Pin repository priority
cat > /etc/apt/preferences.d/hugo <<EOF
Package: hugo
Pin: origin "hugo-apt.8hob.io"
Pin-Priority: 520
EOF
chmod 644 /etc/apt/preferences.d/hugo
# Install Hugo Extended
echo "Updating package list and installing Hugo..."
apt update
apt install -y hugo
# Install git (required for Hugo modules)
apt install -y git
# Verify installation
echo "Verifying installation..."
hugo version
hugo env | grep HUGO_EXTENDED
echo "Hugo Extended installation completed successfully!"
echo "Run 'hugo version' to confirm."