Hugo Extended on Centos 7
This short post shows you how to run the static site generator 'Hugo extended' on CentOS 7.
There is no release build of Hugo extended for CentOS 7 1 2 3
After quite some years of not updating my personal website I decided to lower the barrier for publishing new posts to my Uberspace Host. Maybe this will help me with updating the website more often.
I wanted to have my website versioned on GitHub and deployed everytime I commit a new post to the repo. Setting up repo on GitHub was easy and bringing the deployment in place required to have Hugo installed on my Uberspace Host.
My website is built with the static site generator Hugo and the theme Future Imperfect Slim. Therefore I have to use the extended version of Hugo which includes support for Sass/SCSS.
My first attempt was simple: Download hugo for linux, extract, run, done!
[peter@R4GN4R03K ~]$ cd ~/tmp
[peter@R4GN4R03K tmp]$ wget https://github.com/gohugoio/hugo/releases/download/v0.92.1/hugo_extended_0.92.1_Linux-64bit.tar.gz
[peter@R4GN4R03K tmp]$ tar xvzf ./hugo_extended_0.92.1_Linux-64bit.tar.gz
[peter@R4GN4R03K tmp]$ cp ./hugo ~/bin
[peter@R4GN4R03K tmp]$ cd
[peter@R4GN4R03K ~]$ hugo version
./hugo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./hugo)
./hugo: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./hugo)
./hugo: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./hugo)
There you go. Download hugo for linux, extract, run and NOT done!
Googling, what else?
As a senior engineer I knew that there are not so many problems with well known tools that appear to me as the first person on this earth. So I looked for a solution on the internet.
Fiddling around with LD_LIBRARY_PATH
variable did not help.
After searching for a while and trying other solutions I finally found the saving clue. Thanks to Christoph Cullmann’s personal website!
Compile it Yourself!
And as is often the case in the linux world the answer was: Compile it yourself!
[peter@R4GN4R03K ~]$ mkdir compilehugo
[peter@R4GN4R03K ~]$ cd compilehugo
[peter@R4GN4R03K compilehugo]$ wget https://github.com/gohugoio/hugo/archive/refs/tags/v0.92.1.tar.gz
[peter@R4GN4R03K compilehugo]$ tar xvzf hugo_extended_0.92.1_Linux-64bit.tar.gz
[peter@R4GN4R03K compilehugo]$ cd hugo-0.92.1/
[peter@R4GN4R03K hugo-0.92.1]$ CGO_ENABLED=1 go install -v -x -a --tags extended
[peter@R4GN4R03K hugo-0.92.1]$ cp ~/go/bin/hugo ~/bin
[peter@R4GN4R03K hugo-0.92.1]$ cd
[peter@R4GN4R03K ~]$ hugo version
[peter@R4GN4R03K ~]$ hugo v0.92.1+extended linux/amd64 BuildDate=unknown
After downloading and extracting the source code of hugo you have to compile it with CGO_ENABLED=1 go install -v -x -a --tags extended
.
Normaly you just use this command to compile hugo: CGO_ENABLED=1 go install --tags extended
. But on my host the compilation took quite some time and I wanted to know what is going on and if there is progress at all.
This is why I added the flags -v -x -a
to enable a little bit of verbose output.
After the compiler has finished is magic you can find the hugo
binary in ~/go/bin/hugo
.
-
Image “Install Hugo” is from https://gohugo.io ↩︎
-
Image “Uberspace” is from https://s3.amazonaws.com/keybase_processed_uploads/1347584f23c813642a39937385fa8f05_360_360_square_360.jpeg ↩︎
-
Image “CentOS” is from https://commons.wikimedia.org/wiki/File:CentOS_color_logo.svg ↩︎