An APT repo for Hugo

I made an APT repository that contains the latest Hugo binaries for Debian, Ubuntu, and other Debian derivatives:

To use the repo:

echo 'deb [signed-by=/etc/apt/keyrings/hugo.gpg] https://hugo-apt.8hob.io latest main' | sudo tee /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 apt update && sudo apt install hugo

(Always check out the project homepage in case the commands above become outdated.)

A GitHub Workflow (conceptually a bot) checks the latest deb files from Hugo release page daily, and make them available to install from the repo. If you use Debian, Ubuntu, or a Debian derivative, you are welcome to try out :slight_smile:

3 Likes

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

1 Like