1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi0W にHugo最新版をインストールする(2020.06.21)

Last updated at Posted at 2020-06-21

Raspberry PiZeroW にHugo最新版をインストールしようとしたら苦労した備忘録。

なぜPiZeroWにHugo?

オーディオ再生の実験用にPiZeroWを買ったけど、実験が終わって使い道がなくなった。
有効利用に低消費電力(1Wくらい)を活かしてWebサーバーなんでどうか?
せっかくならSSG(静的サイトジェネレーター)もインストールして単体でWebサイトが構築できるようにしたいなぁ。
PiZeroはCPUが低速なので高速なSSG、Hugoをインストールしよう!

問題点

Ubuntu はPiZeroに対応してない。
Raspberry Pi OS(旧Raspbian)はaptでインストールできるHugoのバージョンが古い。

SnapパッケージにはPiZeroのarmv6lが無い!(Pi2以降ならSnapが使える)

そもそもSnapパッケージはSandBoxの中で動くのでasciidoctorなどの外部プログラムと連携できない。

Hugo公式サイトにバイナリがあるが、やはりPiZero(armv6l)に対応したものはない。

Hugoをソースからインストールする必要があるが、Raspberry Pi OSでaptでインストールできるgolangはバージョンが古くてコンパイルできない。

必要な手順

公式サイトからgolangの最新版のバイナリをインストールする。

golang 公式サイト https://golang.org/
ダウンロードページ https://golang.org/dl/
2020/06/21時点のPiZeroに対応した最新版
go1.14.4.linux-armv6l.tar.gz

# ダウンロード (2020/06/21時点)
curl -O https://dl.google.com/go/go1.14.4.linux-armv6l.tar.gz
# チェックサム確認
sha256sum go1.14.4.linux-armv6l.tar.gz

# インストール
tar -C /usr/local -xzf go1.14.4.linux-armv6l.tar.gz

# パスを通す ~/.bashrcに追記
export PATH=$PATH:/usr/local/go/bin

公式サイトからHugo のソースをダウンロード、コンパイルする。

Hugo 公式サイト https://gohugo.io/
インストールは公式サイトのドキュメント(Sourceの項)通り
https://gohugo.io/getting-started/installing/

mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install

PiZeroでは小一時間かかる。

結論

最速のSSG、HugoをもってしてもPiZeroは遅く実用にするには辛い。
Hugoを使うのは非常用で、通常は別のPCでHugoを使って、出来上がったのもを転送するだけのほうが良さそう。
っていうか、PiZeroじゃなくて、Pi2以降を使おう。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?