Hugo automatic upgrade of new version

I am have developed a new site with hugo locally usinging my linux machine and i am using rsync to publich to my shared linux hosting over internet.
My question is when hugo releases new version what is the easiest way to update the new version locally on my linux PC and publish over internet.

How did you install Hugo locally?

whereis hugo
which hugo
hugo version

whereis hugo
which hugo
hugo version
hugo: /usr/local/bin/hugo
/usr/local/bin/hugo
hugo v0.92.1-85E2E862 linux/amd64 BuildDate=2022-01-27T11:44:41Z VendorInfo=gohugoio

Then i created a folder( /mysite/exsite/mysitefolder) which site posts are there and i use " hugo serve" command

How did you initially install it?

I belive i used
curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest
| grep browser_download_url
| grep Linux-64bit.deb
| grep -v extended
| cut -d ‘"’ -f 4
| wget -i -
sudo dpkg -i hugo_Linux-64bit.deb*

If you do not use Hugo modules in your project(s), the snap install works well, but please understand there are some current limitations:
https://github.com/gohugoio/hugo/issues/9078

The snap updates automatically.

Uninstall the existing version:

sudo rm /usr/local/bin/hugo

Then install the snap package:

sudo snap install hugo --channel=extended/stable

One other note with the snap install…

If you use npm packages in your project (e.g., postcss, postcss-cli, autoprefixer), the packages must be installed within your project, not globally. This restriction is due to the snap security confinement.

is there any way to backup and restore the existing site folder before this process.

First, the hugo installation is independent of your project directory.

Second, you should be using git in conjunction with GitLab, GitHub, etc. to, among other things, protect your data.

1 Like

I have removed the file now. However when trying the installation with snap it gives this error.
"
$ sudo snap install hugo --channel=extended/stable 1 ⨯
error: cannot communicate with server: Post “http://localhost/v2/snaps/hugo”: dial unix /run/snapd.socket: connect: no such file or directory
"

Try Google

This isn’t a Hugo problem.

I did “systemctl start snapd.service” fixed it
But hugo version not working


Are these steps mandatory or is it just for test site creation?

And it is telling you why it is not working. You need to fix your PATH environment variable. Again, check Google, this is not a Hugo problem.

That is not applicable to what you are doing.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.