I do lots of testing and development on EC2 instances, and I like to use Graviton instances because they’re fast and cheap.
One of the things I do with those instances is publish this site, which I build with Hugo. It’s an awesome piece of software, but sadly there is no recent build of Hugo extended (the version I require) for ARM64.
Luckily, we can get around this by building it ourselves. Here are steps for a Graviton instance running Ubuntu 24.04.
Hugo (Extended) build steps Link to heading
First, we must install go:
sudo apt-get install golang-go
Then, we pull the latest version of hugo with go install
:
go install github.com/gohugoio/hugo@latest
Go will automatically create a directory (in whatever directory you were in when you executed the command above, so be careful with that). Next, we run the build:
CGO_ENABLED=1 go install -tags extended,withdeploy github.com/gohugoio/hugo@latest
Finally, we add the go/bin
folder (created in the go install
step above) to our PATH
:
export PATH=$PATH:/home/ubuntu/go/bin
Bam! Hugo is now ready to run. If you want to make this a permanent change, add the export
command above to whatever script your shell runs at logon. On Ubuntu that should be .bashrc
.