英文:
How to install Hugo?
问题
我已经从发布页面下载并解压了hugo_0.11_linux_amd64.tar.gz
文件,但我不知道如何运行这个二进制文件。我尝试了使用go run
和sh
命令,但没有成功。有人可以提供更多详细信息吗?
英文:
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的说明进行操作。
参考资料:
英文:
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:
答案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 executablehugo
, 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:\
calledHugo
. - Create another folder inside of
C:\Hugo
calledbin
- 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. Typeset 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论