如何安装Hugo?

huangapple go评论92阅读模式
英文:

How to install Hugo?

问题

我已经从发布页面下载并解压了hugo_0.11_linux_amd64.tar.gz文件,但我不知道如何运行这个二进制文件。我尝试了使用go runsh命令,但没有成功。有人可以提供更多详细信息吗?

英文:

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?

答案1

得分: 11

hugo_0.11_linux_amd64.tar.gz解压到一个目录中。在该目录中,您应该找到三个文件:

hugo_0.11_linux_amd64  LICENSE.md  README.md

确保hugo在您的路径中,或者提供一个路径给它。例如,将hugo_0.11_linux_amd64可执行文件重命名为hugo。将hugo可执行文件移动到/usr/local/bin目录中。

运行

$ hugo help

继续按照使用Hugo的说明进行操作。

参考资料:

Hugo

Hugo文档:入门指南

英文:

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

答案2

得分: 4

安装页面中提到:

> 下载后,可以从任何位置运行。您不需要将其安装到全局位置。
最好将其安装在您的路径中以便于使用。/usr/local/bin 是最有可能的位置。

只要:

  • 您选择了适合您架构的正确版本(Linux、Mac 或 Windows)

  • 将可执行文件重命名为 hugo(或创建一个名为 hugo 的符号链接)

  • 您的 $PATH(或 Windows 上的 %PATH%)环境变量引用了可执行文件 hugo,您就可以开始使用它了。

      hugo new site /path/to/site
    
英文:

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
    

答案3

得分: 4

这是一个旧问题,但我觉得这可能对后来的某个人有所帮助。我在Windows上(是的,我知道这是为Linux准备的),并且在创建的目录之外运行Hugo,即hugo.exe所在的目录。

请注意, hugo.exe 不必像下面的示例那样位于 c:\hugo\bin

  • 从https://github.com/spf13/hugo/releases下载Hugo(64位或32位)
  • C:\上创建一个名为Hugo的文件夹。
  • C:\Hugo文件夹内创建另一个名为bin的文件夹。
  • 将从HUGO URL下载的文件解压缩到bin文件夹中。
  • 打开cmd.exe,将HUGO的路径添加到Windows的PATH环境变量中。输入set PATH=%PATH%;C:\Hugo\bin

要验证Hugo是否全局安装,在命令提示符下的任何目录中输入where hugo,它会告诉你它的位置(在我们的例子中是c:\hugo\bin\hugo.exe

从那里,你应该能够从硬盘上的任何存储库中运行你的Hugo网站。

英文:

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.

答案4

得分: 4

>平台:Linux

以下内容适用于Linux操作系统:

>下载和解压缩

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

注意:在curl命令中使用-L标志以允许GitHub触发的重定向。

>移动到/usr/local/bin目录

mv hugo /usr/local/bin/hugo

一旦移动到该目录,就可以直接使用hugo命令,无需设置路径。

英文:

>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.

huangapple
  • 本文由 发表于 2014年9月1日 02:29:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/25595011.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定