Install Hugo testing distribution on Debian
All notes in this series:
- (1) Automating hugo development with npm scripts
- (2) normalize-scss with hugo
- (3) Automatic image thumbnails in Hugo from static directory
- (4) Escaping Hugo shortcodes within Hugo markdown
- (5) Hugo tag and category pages
- (6) Bind hugo to localhost for development
- (7) Hugo 0.37 does not support h6 markdown heading
- (8) Install Hugo testing distribution on Debian
- (9) Hugo anchors next to headers
- (10) Hugo: Migrating from Pygments to Chroma
- (11) Hugo: Global resources
On a default installation of Debian, trying to install hugo with apt install hugo
will fetch the latest stable
version of Hugo, which at time of writing is v0.18.1, and was released in December 2016! I would like to install the more recent version 0.47.1 which came out last month in August 2018. However it is on the testing
distribution so by default cannot be installed. To enable installing the testing
version of Hugo, follow these steps:
Edit /etc/apt/apt.conf
((which did not already exist)[https://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html#s-default-version]) to set stable
as the default distribution. This will ensure that when the apt
command is used, the stable
distibution is always assumed unless otherwise specified:
/etc/apt/apt.conf §
APT::Default-Release "stable";
Next, update the apt sources list to enable the testing
distribution for the repository that contains Hugo. For this, I created a /etc/apt/sources.list.d/testing.list
file with the following:
/etc/apt/sources.list.d/testing.list §
deb http://ftp.uk.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ testing main contrib non-free
Now, after running apt update
, you can install the testing
distribution of Hugo using the -t
option:
$ apt -t testing install hugo
To confirm:
$ hugo version
Hugo Static Site Generator v0.47.1/extended linux/amd64 BuildDate: 2018-09-25T03:41:10Z
Note that if you have not run apt update
or have not added testing
to a source list which contains Hugo, then you will get the following error:
$ sudo apt -t unstable install hugo
Reading package lists... Done
E: The value 'unstable' is invalid for APT::Default-Release as such a release is not available in the sources
A word of caution: beware about using testing
or unstable
distributions in general, but in particular for packages which have dependencies.