Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Run Hugo on an Android phone

First install Termux

Then there are two options:

Build from source

Open the Termux terminal on your Android device and copy-and-paste the commands listed below and hit ENTER:

apt update;\
apt install -y git golang make;\
export GOPATH=$HOME/go;\
export PATH=$PATH:$GOPATH/bin;\
go get -d github.com/spf13/hugo;\
cd $GOPATH/src/github.com/spf13/hugo;\
make install;\
hugo server -s docs;

Now you can point a browser at http://localhost:1313 and you should see the Hugo site with docs and all.

Use a prebuilt release binary

apt update;\
apt install curl;\
curl -L https://github.com/spf13/hugo/releases/download/v0.20/hugo_0.20_Linux_ARM.tar.gz | tar zxf -
@mrbrianhinton

This comment has been minimized.

Show comment
Hide comment
@mrbrianhinton

mrbrianhinton Oct 15, 2017

I've been trying to get Hugo to run on my Samsung Chromebook Pro via Termux. I've tried both of your options, and I can seem to get it to work at all. I'm getting an error that it's an unsupported architecture when I try to build it. Specifically I've been trying to get https://github.com/netlify/victor-hugo to work, and I haven't had success. Any thoughts, and assistance would be appreciated.

I've been trying to get Hugo to run on my Samsung Chromebook Pro via Termux. I've tried both of your options, and I can seem to get it to work at all. I'm getting an error that it's an unsupported architecture when I try to build it. Specifically I've been trying to get https://github.com/netlify/victor-hugo to work, and I haven't had success. Any thoughts, and assistance would be appreciated.

@mrbrianhinton

This comment has been minimized.

Show comment
Hide comment
@mrbrianhinton

mrbrianhinton Oct 15, 2017

The make version fails completely, and won't "make" due to a makeinstall not being present.
The pre-built release binary downloads, but I can't seem to get it to run.

The make version fails completely, and won't "make" due to a makeinstall not being present.
The pre-built release binary downloads, but I can't seem to get it to run.

@jerjungle

This comment has been minimized.

Show comment
Hide comment
@jerjungle

jerjungle Jan 21, 2018

same here, this wont work.
attached is a screenshot.
screenshot_20180121-195413

same here, this wont work.
attached is a screenshot.
screenshot_20180121-195413

@DanShrader

This comment has been minimized.

Show comment
Hide comment
@DanShrader

DanShrader Jan 29, 2018

@mrbrianhinton and @jerjungle,

I don't know if either of these posts will help you, but there what I did using the above gist as a base. It works with a Intel based Thinkpad Chromebook as least. I think the Samsung Chromebook Pro is also Intel based, so it 'should' work.

For Chromebooks there's a step or two extra needed and it's documented in the post. I too had the problem with the make command, but found that it was not 'needed' in my case.

@mrbrianhinton and @jerjungle,

I don't know if either of these posts will help you, but there what I did using the above gist as a base. It works with a Intel based Thinkpad Chromebook as least. I think the Samsung Chromebook Pro is also Intel based, so it 'should' work.

For Chromebooks there's a step or two extra needed and it's documented in the post. I too had the problem with the make command, but found that it was not 'needed' in my case.

@kisik21

This comment has been minimized.

Show comment
Hide comment
@kisik21

kisik21 Apr 8, 2018

It tries to create /tmp on my phone. On read-only file system. Can one move hugo-cache dir somehow?

kisik21 commented Apr 8, 2018

It tries to create /tmp on my phone. On read-only file system. Can one move hugo-cache dir somehow?

@kisik21

This comment has been minimized.

Show comment
Hide comment
@kisik21

kisik21 Apr 8, 2018

$ hugo server
panic: mkdir /tmp: read-only file system

goroutine 1 [running]:
github.com/gohugoio/hugo/vendor/github.com/spf13/afero.GetTempDir(0xb26c18, 0xf1eac0, 0x8ed410, 0xa, 0x0, 0x0)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/afero/util.go:128 +0x270
github.com/gohugoio/hugo/helpers.GetTempDir(0x8ed410, 0xa, 0xb26c18, 0xf1eac0, 0x0, 0x1)
	/go/src/github.com/gohugoio/hugo/helpers/path.go:540 +0x34
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0x12acd800, 0x12acd801, 0x1, 0x1)
	/go/src/github.com/gohugoio/hugo/commands/commandeer.go:239 +0x954
github.com/gohugoio/hugo/commands.newCommandeer(0x12ba8501, 0x12ab5290, 0x12a39e28, 0x1, 0x1, 0x84f348, 0x1, 0x12ab5290)
	/go/src/github.com/gohugoio/hugo/commands/commandeer.go:113 +0x188
github.com/gohugoio/hugo/commands.InitializeConfig(0x1, 0x12ab5290, 0x12a39e28, 0x1, 0x1, 0x12a5ee00, 0x12a5f01c, 0x0)
	/go/src/github.com/gohugoio/hugo/commands/hugo.go:296 +0x3c
github.com/gohugoio/hugo/commands.server(0xf025b8, 0xf1ed1c, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/gohugoio/hugo/commands/server.go:215 +0x138
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute(0xf025b8, 0xf1ed1c, 0x0, 0x0, 0xf025b8, 0xf1ed1c)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:753 +0x360
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xf018a8, 0x97db74, 0x1, 0x15724)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:843 +0x20c
github.com/gohugoio/hugo/commands.Execute()
	/go/src/github.com/gohugoio/hugo/commands/hugo.go:182 +0x4c
main.main()
	/go/src/github.com/gohugoio/hugo/main.go:27 +0x24

kisik21 commented Apr 8, 2018

$ hugo server
panic: mkdir /tmp: read-only file system

goroutine 1 [running]:
github.com/gohugoio/hugo/vendor/github.com/spf13/afero.GetTempDir(0xb26c18, 0xf1eac0, 0x8ed410, 0xa, 0x0, 0x0)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/afero/util.go:128 +0x270
github.com/gohugoio/hugo/helpers.GetTempDir(0x8ed410, 0xa, 0xb26c18, 0xf1eac0, 0x0, 0x1)
	/go/src/github.com/gohugoio/hugo/helpers/path.go:540 +0x34
github.com/gohugoio/hugo/commands.(*commandeer).loadConfig(0x12acd800, 0x12acd801, 0x1, 0x1)
	/go/src/github.com/gohugoio/hugo/commands/commandeer.go:239 +0x954
github.com/gohugoio/hugo/commands.newCommandeer(0x12ba8501, 0x12ab5290, 0x12a39e28, 0x1, 0x1, 0x84f348, 0x1, 0x12ab5290)
	/go/src/github.com/gohugoio/hugo/commands/commandeer.go:113 +0x188
github.com/gohugoio/hugo/commands.InitializeConfig(0x1, 0x12ab5290, 0x12a39e28, 0x1, 0x1, 0x12a5ee00, 0x12a5f01c, 0x0)
	/go/src/github.com/gohugoio/hugo/commands/hugo.go:296 +0x3c
github.com/gohugoio/hugo/commands.server(0xf025b8, 0xf1ed1c, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/gohugoio/hugo/commands/server.go:215 +0x138
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).execute(0xf025b8, 0xf1ed1c, 0x0, 0x0, 0xf025b8, 0xf1ed1c)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:753 +0x360
github.com/gohugoio/hugo/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xf018a8, 0x97db74, 0x1, 0x15724)
	/go/src/github.com/gohugoio/hugo/vendor/github.com/spf13/cobra/command.go:843 +0x20c
github.com/gohugoio/hugo/commands.Execute()
	/go/src/github.com/gohugoio/hugo/commands/hugo.go:182 +0x4c
main.main()
	/go/src/github.com/gohugoio/hugo/main.go:27 +0x24
@ntrrg

This comment has been minimized.

Show comment
Hide comment
@ntrrg

ntrrg May 4, 2018

The problem is that Hugo doesn't use Make, it uses mage instead, so it is necessary to replace make install with:

go get -v github.com/magefile/mage
mage vendor
mage install

ntrrg commented May 4, 2018

The problem is that Hugo doesn't use Make, it uses mage instead, so it is necessary to replace make install with:

go get -v github.com/magefile/mage
mage vendor
mage install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment