How to install Hugo?
Asked Answered
S

5

8

I have downloaded and unzipped the hugo_0.11_linux_amd64.tar.gz file from the releases page, and I cannot figure out how to run the binary. I took a few stabs at using go run, and sh, but no luck. Can anyone offer a few more details?

Struthious answered 31/8, 2014 at 18:29 Comment(1)
It would be good if this question covered Windows as well as Linux. I know I can put hugo.exe anywhere but where is the best place if I'm using "Git for Windows"? My second thought is to have a 'command-line' folder in 'My Documents' for all my utilites and put that in the Path. I tried putting it in C:\command-line and adding that to the Path but I can't see it in Git bash.Hema
M
11

Extract hugo_0.11_linux_amd64.tar.gz to a directory. In that directory you should find three files:

hugo_0.11_linux_amd64  LICENSE.md  README.md

Make sure either hugo is in your path or provide a path to it. For example, rename the hugo_0.11_linux_amd64 executable file to hugo. Move the hugo executable file to /usr/local/bin.

Run

$ hugo help

Continue to follow the instructions for Using Hugo.

References:

Hugo

Hugo Documentation: Getting Started

Moazami answered 31/8, 2014 at 20:41 Comment(1)
Okay, I thought what I downloaded was an installation script that needed to be run, I didn't realize that all I had to do was rename it and move it somewhere. This helps a lot, thanks!Struthious
C
4

The installation page does mention:

Once downloaded it can be run from anywhere. You don’t need to install it into a global location.
Ideally you should install it somewhere in your path for easy use. /usr/local/bin is the most probable location.

As long as:

  • you chose the right release for your architecture (linux, Mac or Windows)
  • rename the executable to hugo (or make a symlink to it, named hugo)
  • your $PATH (or %PATH% on Windows) environment variable references the executable hugo, you can start using it.

    hugo new site /path/to/site
    
Cyanocobalamin answered 31/8, 2014 at 18:31 Comment(0)
F
4

Old question, but I figured this could help somebody down the road. I'm on Windows (yes I know this was for Linux) and was running Hugo outside the created directory where hugo.exe lives.

Note that the hugo.exe doesn't have to live in c:\hugo\bin as per the example below

  • Download Hugo (64 or 32-bit) from https://github.com/spf13/hugo/releases
  • Create a folder on your C:\ called Hugo.
  • Create another folder inside of C:\Hugo called bin
  • Unzip the file downloaded from the HUGO URL into the bin folder
  • Open cmd.exe to add the path to HUGO to the windows PATH environment variables. Type set PATH=%PATH%;C:\Hugo\bin

To verify that hugo is installed globally, under any directory in command prompt type where hugo and it'll tell you where it is (in our case, c:\hugo\bin\hugo.exe)

From there you should be able to run your Hugo sites from any repository on your HD.

F answered 30/8, 2016 at 14:11 Comment(0)
A
4

Platform : Linux

Following works on Linux

Download and Unzip

curl -L https://github.com/gohugoio/hugo/releases/download/v0.54.0/hugo_0.54.0_Linux-64bit.tar.gz | tar xvz 

NOTE - -L flag is used in curl to allow github triggered redirects

Move to /usr/local/bin

mv hugo /usr/local/bin/hugo

Once moved to this repo, hugo would be accessible without setting path.

Acetophenetidin answered 12/3, 2019 at 19:3 Comment(1)
Just what I needed for an alpine container. Thanks.Ledger
P
0

Add Hugo Path from inside Powershell

If you don't want to reboot your system, you can also add the path directly through powershell using this command:

$env:Path += ";C:\hugo\bin"

(replace with your own path to the hugo executable)

To check if the new variable works, run

hugo version

If you have multiple Hugo versions installed, you might need to specify the full path to the specific hugo executable you want to use.

Add Hugo Path (Windows)

n case you want to add the variable in Windows:

  • Right-click "This PC" and select "Properties".
  • Click "Advanced system settings" and then "Environment Variables".
  • Under "System variables", find "Path" and click "Edit".
  • Click "New" and enter the path to your Hugo bin directory. In my case: C:\hugo\bin.
  • Click "OK" on all open windows to save the changes.
  • Reboot
Pinafore answered 13/2, 2024 at 10:25 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.