This guide outlines the steps to install Hugo from its community-maintained APT repository. This is an unofficial repository; it is not maintained by the Hugo project team.
Step 1: Accommodate Expanded Security Maintenance (ESM)
With Ubuntu, if Expanded Security Maintenance (ESM) is enabled, you must prioritize the third-party Hugo repository to ensure successful installation.
Create and edit a new APT preferences file:
sudo touch /etc/apt/preferences.d/hugo
sudo chmod 644 /etc/apt/preferences.d/hugo
sudo nano /etc/apt/preferences.d/hugo
Add the following content to the file:
Package: hugo
Pin: origin "hugo-apt.8hob.io"
Pin-Priority: 520
Save the file and exit the editor (Ctrl+X, Y, Enter).
Step 2: Determine your system architecture
Before proceeding, identify your system’s architecture:
dpkg-architecture -q DEB_HOST_ARCH
Note the output (e.g., amd64
, arm64
).
Step 3: Add the Hugo APT repository and install Hugo
Change amd64
in the first line below to match the architecture determined in Step 2.
echo 'deb [arch=amd64 signed-by=/etc/apt/keyrings/hugo.gpg] https://hugo-apt.8hob.io latest main' | sudo tee /etc/apt/sources.list.d/hugo.list
sudo chmod 644 /etc/apt/sources.list.d/hugo.list
sudo mkdir -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/hugo.gpg https://hugo-apt.8hob.io/signing-key
sudo chmod 644 /etc/apt/keyrings/hugo.gpg
sudo apt update && sudo apt install -y hugo
Verify the installation:
/usr/local/bin/hugo version
Uninstall
To uninstall Hugo and remove associated repository files:
sudo apt purge hugo
sudo rm /etc/apt/sources.list.d/hugo.list
sudo rm /etc/apt/keyrings/hugo.gpg
sudo rm -f /etc/apt/preferences.d/hugo
You can safely ignore warnings such as:
dpkg: warning: while removing hugo, directory ‘/usr/local’ not empty so not removed
dpkg: warning: while removing hugo, directory ‘/usr/local/bin’ not empty so not removed