Installing Hugo in CentOS 7

Alexandru Calcatinge bio photo By Alexandru Calcatinge

Introduction

Hugo is another static website generator just like Jekyll. As it is already available in Ubuntu (of courseā€¦) Debian and Fedora through one apt or dnf install command, you can also install it in CentOS by enabling an extra repository. Here is how to do it.

Installation

Before installation, I should worn you that the repository you are about to set up is NOT an official one. Therefore, in add it and install the packages at your own risk.

First, you will need to create a new file in the specific repository directory of CentOS, which is /etc/yum.repo.d/. I named my new file copr-daftaupe.repo after the name of the COPR repo maintainer. More info you can find here.

Now, inside the newly created file, insert the following:

[daftaupe-hugo]
name=Copr repo for hugo owned by daftaupe
baseurl=https://copr-be.cloud.fedoraproject.org/results/daftaupe/hugo/epel-7-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/daftaupe/hugo/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

After that, save the file and do an update with the command:

sudo yum update

This will ensure that the repository is up to date and enabled. Next, you will have to just install Hugo with the command:

sudo yum install hugo

And the system will offer to install Hugo version 0.35. Hugo version 0.36 was just announced today, on February 5th, therefore it is not yet available in the repository. If you want to have the latest available version, you should install it as a snap package in another distro like Ubuntu, Debian, Mint, Fedora etc. If you want to see the available distros that support snapd you can check [this][snapd-list].

Here you go, now you have Hugo installed on your system. All you need to do now is to learn how to use it. For this, you can check the official quick start page here.