Introduction

More often than not you need the latest version of sofware package for development. Here I cover how to install the latest version of hugo, a great website builder that’s written in the GO language. When you install golang(GO) from the command line via apt or yum it will be a version from your Linux software repo, but this version may not suffice for building the latest version of hugo and other cutting edge features. So…

Uninstall existing GO

First I recommend removing existing installed version of GO.

# For Ubuntu/Debian based distros
$sudo apt purge golang -y
$sudo apt autoremove -y
# For Fedora/RedHat based distros
$sudo dnf purge golang -y
# Make sure go is gone :)
$which go
# Should return nothing
$

Install latest GO from GO distribution

We install the latest GO directly from their release site “https://golang.org/dl". Choose the latest version. For me it was 17 at the time.

$wget -c https://golang.org/dl/go1.17.linux-amd64.tar.gz
$tar xvzf go1.17.linux-amd64.tar.gz
# Move GO to a convenient location of your choice
$sudo mv go /opt/local
# Append this to the end of your ~/.bashrc
export PATH=$PATH:/opt/local/go/bin:$HOME/go/bin
# Adding $HOME/go/bin to .bashrc because when GO builds and installs hugo
# it will be installed into $HOME/go by default
# You can change where GO installs software by setting GOPATH
$source ~/.bashrc
$which go
# Should return
$/opt/local/bin/go
$go version
# Should return
$go version go1.17 linux/amd64

Build + Install Hugo

$git clone https://github.com/gohugoio
$cd hugo
# Build and install the Extended hugo
# needed by some modern themes
$go install --tags extended
$hugo version
# Should return similar
$hugo v0.88.0-DEV+extended linux/amd64 BuildDate=unknown

You are now ready do download some themes and build your website. For more info check hugo docs. This site uses the hello-friend-ng theme.