Install Hugo on Windows Subsystem for Linux (WSL)
I’m trying to install Hugo on Windows Subsystem for Linux (WSL) in order to use it for one of my sites hosted in my Windows user’s Dropbox folder at WSL path
/mnt/c/Users/myuser/Dropbox. How do I install Hugo such that it’s available in that path?
First off, I’d advise checking the official Hugo install docs to see if any of those methods work for you. Those will almost certainly be better maintained than the answer I’m about to provide here. That being said, I did try to follow those docs for my own WSL installation of Hugo and found them to be lacking.
So if you tried to do the same without much success, then read on brave adventurer!
First of all, some context. The problem with many of the guides in the official docs is that they encourage downloading your executable to a local directory controlled by your user. In most cases, this makes sense. It gives your user control over your executable with protections against others messing with it or for your executable to be able to touch things outside of your bounds.
However, with WSL, the idea of user boundaries kinda breaks down as, if you’re trying to modify folders in your Windows user’s domain, you’re already going to be outside of your WSL user’s domain and thus will need to install all executables in a place where they can be accessed globally.
As such, the method in which we’ll be installing hugo will allow your wsl command prompt to access the install regardless of where you are in the file structure. Alright, enough chit-chat.
From here on out, all directories will be within the WSL prompt.
- Go to https://github.com/gohugoio/hugo/releases to see the list of latest releases and find the one for your target WSL install.
I chose Ubuntu for my WSL install so I picked
Download that release. This will put the download in your Windows user’s
Downloads/folder. Note that, to access this folder via WSL, you will need to go to
Extract the tarball by using
tar -xvzf /mnt/c/Users/YOURUSERHERE/Downloads/HUGOTARBALLNAME /usr/local/bin. Note that you may need to prepend
sudoto the beginning of that command to elevate to the appropriate permissions to access the
After that, Hugo should be installed. To verify, try running
hugo version from within WSL.