HUGO is a static site generator that allows you to build websites quickly and securely. In this guide, we’ll install HUGO locally on an Arch Linux system, including Node.js and NPM for front-end tooling. Finally, we’ll show how to deploy changes to the web server using rsync.
Information
This guide assumes an existing web server where your site will be published, for example under /var/www/example.com/public/, as described in other articles.
Requirements
- A (local) system running Arch Linux or a derivative (such as EndeavourOS or Manjaro)
- A domain name
- DNS configured to point to the server’s IP address
- A working web server (NGINX) handling requests for your domain
suorsudoprivileges to run commands as root
Preparation
Make sure your system is up to date before installing HUGO.
sudo pacman -Syu
Installing HUGO
Install HUGO from the official Arch Linux repositories.
sudo pacman -S hugo
hugo version
Installing Node.js and NPM
sudo pacman -S nodejs npm
node -v
npm -v
Creating a new HUGO site
mkdir -p ~/sites/example.com
cd ~/sites/example.com
hugo new site .
Add a theme:
git init
git submodule add https://github.com/theme/example-theme.git themes/example-theme
nano config.toml
Add:
theme = "example-theme"
Running a local test site
hugo server -D
Visit http://localhost:1313 to preview your site.
Building for production
hugo
The generated files are in ./public/.
Uploading with rsync
rsync -avz --delete ./public/ user@server:/var/www/example.com/public/
Visit https://example.com to see it live.