In this tutorial, we will show you how to install Hugo on Ubuntu 20.04 LTS. For those of you who didn’t know, Hugo is an open-source static website generator designed for small projects and informative sites. It is written in the Go language, making it very secure and extremely fast. Hugo provides a great writing experience and is optimized for website viewing. Hugo supports unlimited content types, taxonomies, menus, dynamic API-driven content, and more, all without plugins. Additionally, you can output your content in multiple formats, including JSON or AMP
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Hugo static website engine on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Hugo on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing Hugo on Ubuntu 20.04.
- Install Hugo using a Snap Package.
By default, Hugo is not available in the Ubuntu 20.04 default repository. Now install Hugo using Snap:
sudo snap install hugo
- Install Hugo via Git repository.
Run the following command to download the latest version of the Hugo package:
Next, install it with the following command below:
dpkg -i hugo_0.87.0_Linux-64bit.deb apt install -f
Step 3. Create a Website Using Hugo.
Now that Hugo is installed, you can start creating website content:
hugo new site hugo.idroot.us
Congratulations! Your new Hugo site is created in /root/hugo.idroot.us. Just a few more steps and you're ready to go: 1.Download a theme into the same-named folder. Choose a theme from https://themes.gohugo.io/ or create your own with the "hugo new theme <THEMENAME>" command. 2. Perhaps you want to add some content. You can add single files with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>". 3. Start the built-in live server via "hugo server".
Next, change the directory to your website and create a new page named
main.md with the following command below:
cd hugo.idroot.us hugo new main.md
After that, edit the
main.md page and add some content:
Add the following lines:
# Test Page This is my first test page.
Congratulations! You have successfully installed Hugo. Thanks for using this tutorial for installing the Hugo static HTML on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Hugo website.