bucket-sort logo bucket-sort

プログラミングとインフラエンジニアリングの覚え書き

  • Posts
  • About
  • Contact
  1. Home
  2. All Posts
  3. ローカル環境にHugoをインストールする

ローカル環境にHugoをインストールする

Jan 22, 2026 Hugo bucket-sort

以前の記事 に書いた静的サイトジェネレーター「Hugo」を使って、このサイトの運営を始めていこうとと思います。

サイトの運営は、以下のような流れになります。

  1. ローカル環境に Hugo をインストールする(初期設定)。
  2. ローカル環境でマークダウンで記事を書く。
  3. ローカル環境でサイトをビルドする。
  4. ビルドしたサイトをサーバーへ転送する。

公式サイト

The world’s fastest framework for building websites
https://gohugo.io/

Quick start
https://gohugo.io/getting-started/quick-start/

Releases · gohugoio/hugo
https://github.com/gohugoio/hugo/releases

Hugo をインストールする

自分は Windows マシンの WSL 上で動く Ubuntu に Hugo をインストールします。

# OS バージョン確認
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

# インストールされる Hugo のバージョンを確認
$ apt show hugo
Package: hugo
Version: 0.123.7-1ubuntu0.3

# バージョンが古い(最新版は0.155.2)のでリリース版を取得してインストール
$ wget https://github.com/gohugoio/hugo/releases/download/v0.155.2/hugo_extended_0.155.2_linux-amd64.deb
$ sudo dpkg -i hugo_extended_0.155.2_linux-amd64.deb
$ hugo version
hugo v0.155.2-d8c0dfccf72ab43db2b2bca1483a61c8660021d9+extended -
    linux/amd64 BuildDate=2026-02-02T10:04:51Z VendorInfo=gohugoio

初期設定

テーマの選択

公式サイトで好みのテーマを選んでおきます。

Hugo Themes
https://themes.gohugo.io/

自分はこちらのテーマを使わせてもらいました。

Explore
https://themes.gohugo.io/themes/explore/

サイトの作成

$ hugo new site blog
$ cd blog
$ git init

# テーマをインストール
$ git submodule add https://github.com/yogirk/explore.git themes/explore
# テーマにサンプルの設定ファイルが付属していたので有効化
$ cp themes/explore/exampleSite/config.toml .
# 必要に応じて設定を編集
$ vi config.toml

コンテンツの追加

$ hugo new posts/my-first-post.md

# マークダウンで記事を書く
$ vi posts/my-first-post.md
+++
date = '2026-01-22T14:22:52-08:00'
draft = true
title = 'My First Post'
+++

## Introduction

This is **bold** text, and this is *emphasized* text.

Visit the [Hugo](https://gohugo.io) website!

# ローカルサーバーを起動
$ hugo server -D

ローカルサイトで確認
http://localhost:1313/

サイトのビルド

$ hugo
public/にコンテンツが出力される

public/ 以下をサーバーに転送すれば、静的サイトとして公開されます。

参考: Hugo で生成した静的サイトを Makefile でデプロイする

Hugo CMS
← AlmaLinux 9.5のPHPをアップデートする (8.2 → 8.3 → 8.4) Hugoで生成した静的サイトをデプロイするMakefile →

Related Posts

  • Hugoで生成した静的サイトをデプロイするMakefile Jan 23, 2026
  • 静的サイトジェネレーター「Hugo」とは Jan 2, 2026
  • インフラ目線で考えるWordPressの嫌いなところ Jan 1, 2026

Table of Contents

  • 公式サイト
  • Hugo をインストールする
  • 初期設定
    • テーマの選択
    • サイトの作成
  • コンテンツの追加
  • サイトのビルド

Recent Posts

  • Laravel の Event / Listener で Pub/Sub を実装する Apr 2, 2026
  • [C#] delegate と event の仕組みを整理する Apr 1, 2026
  • Pub/Sub パターンとは何か Mar 31, 2026
  • PHP/Laravel で値の状態を判定するヘルパ関数まとめ Mar 30, 2026
  • Filament の dehydrated メソッドとは何か Mar 29, 2026

Categories

  • AWS27
  • C#22
  • .NET20
  • Laravel16
  • Linux12
  • Apache8
  • MySQL8
  • PHP8
  • DynamoDB6
  • Nginx5
  • WordPress4
  • インフラ4
  • Hugo3
  • セキュリティ3
  • .NET Framework1
  • Aurora1
  • Filament1
  • Git1
  • SQS1

Tags

  • AWS
  • C#
  • .NET
  • Laravel
  • PHP
  • MySQL
  • セキュリティ
  • Linux
  • Apache
  • Code Snippet
  • DynamoDB
  • NoSQL
  • PHP-FPM
  • RDS
  • DoS
  • Nginx
  • Windows
  • WordPress
  • パフォーマンス
  • 監視
  • Amazon Linux 2023
  • CMS
  • Docker
  • Ipset
  • Iptables
  • OPCache
  • Webサーバー
  • 認可
  • Aurora
  • Blade
Powered by Hugo & Explore Theme.