I recently got a new laptop that runs Pop OS, an OS made by System76 based from Ubuntu. In learning about the best way to install and run Hugo, I learned that APT doesn’t have the latest versions. Also, since some Hugo themes are built for specific versions and they break with the newer versions, I thought it might be best to be able to run different Hugo versions as needed. This Stackoverflow question and its answer gave me the best system to use. Other suggestions were more complicated, like running different Docker containers for each version, and I really like simple solutions.
So, just how do you have and use different Hugo versions on the same machine?
First, download the proper Hugo release from github for your machine. In my case, it’s the .deb for version 0.80.0 for Linux 64-bit.
After downloading it, I rename the file to something easier to type, so I rename it to ‘hugo.’
sudo dpkg -i hugo
go to the location where it was installed:
Rename it so it has the version number. For v0.80.0, I renamed it hugo0800
sudo mv hugo /usr/local/bin/hugo0800
If all I want is one version, I’d be done, but I want to have another version which is what this blog post is about. Download the other version (the 0.76.3 version this time), rename it, and install just like the 0.80.0 version.
sudo dpkg -i hugo
I got a warning, but I suppose it doesn’t matter.
Proceed to rename the binaries…
cd /usr/local/bin sudo mv hugo /usr/local/bin/hugo0763
Ok, now we have 2 versions installed. We use them the same way as plain ‘hugo’ but with the new names. Let’s confirm they work as expected. First, let’s see if they report the right versions…
It’s looking really good. Then let’s test with an actual site….
hugo0763 server -D
hugo0800 server -D
Browsing to http://localhost:1313/ shows that the site works for either version
Done! Repeat for other Hugo versions as needed.
Small side note:
I’ve switched from a 2013 Macbook air with macOS 10.15.7 Catalina, 1.7 GHz dual-core Intel i7 and 8GB RAM. For this site am working on, it took that machine 8000-9000 ms to build…
My new machine is a System76 Lemur Pro running Pop!_OS 20.04 with an 11th Gen 4.7 GHz Intel i7 (4 cores, 8 threads) with 25 GB RAM and it takes it 61ms to build! What a huge difference!!