In this post, we will see how we can install Hugo on our Ubuntu (or any Debian based) system.

Hugo is a very popular open-source static site generator (SSG) that is build with Go. It is mainly known for its speed and flexibility.

Hugo can be used by experienced Front-End developers that can create their custom themes with the Hugo templating system, but can also be used by novice users that want to create their own webpage with little to none knowledge. This is possible thanks to the large collection of Themes that Hugo developers have contributed.

Hugo Installation

In order to install the latest version in an Ubuntu distro we can download the latest .deb package from GitHub:

wget https://github.com/gohugoio/hugo/releases/download/v0.82.1/hugo_extended_0.82.1_Linux-64bit.deb

Find the latest version in the Release Page

Once the package is downloaded, you can install it with the following command:

sudo dpkg -i hugo_extended_0.82.1_Linux-64bit.deb

If you see any dependency errors, you can resolve them with the following command:

sudo apt install -f

After installation, verify that Hugo is installed properly:

hugo version

Hugo Commands

Some basic commands to operate hugo.

Create a new website

hugo new site SiteName

Where SiteName is the name of your site.

Create a new page

hugo new PageName.md

Where PageName.md is the name of the page.

Build the website

hugo

Serve the website

Serve the website only for the localhost machine:

hugo serve -D

The -D option serves also the draft files.

Server the website for all machines on the local network:

hugo serve -D --baseUrl=http://192.168.1.99 --bind=0.0.0.0

where the IP in the baseUrl is the IP of your hosting machine.