Install Hugo on Ubuntu to generate static websites

Whilst there is a .DEB installer to download from the GoHugo sites I get all matter of warnings that the package is of bad quality and I am not comfortable to run these kinds of installers.

Hugo Logo

I rather install from sources in this case which is very straight forward since the main dependencies (largely GO) are in the Ubuntu main repositories.

Install dependencies

sudo apt-get install golang git mercurial python-pygments

Create environment variables

vim ~/.bashrc
#add the following 3 lines
export GOROOT=/usr/lib/go
export GOPATH=$HOME/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Update Bash Environment Variables without logging out.

source ~/.bashrc

Install Hugo

go get -u -v

Start using Hugo

#create new site
hugo new sitename /path/to/sitename
#change directory to site
cd /path/to/sitename
#create content page
hugo new
#edit content page
vim content/

Leo Gaggl

ict business owner specialising in mobile learning systems. interests: sustainability, internet of things, ict for development, open innovation, agriculture

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu