Installing Hugo on Dreamhost's Ubuntu 18.04LTS version

Recently, I needed to upgrade the version of hugo generating this website. As I have other active projects that require dynamic execution, I’ve retained a level of hosting outside of the static variety available with GitHub Pages and Netlify. The main host that I’ve used for about 10 years+ now is Dreamhost. Unfortunately, Dreamhost does not provide sudo access for those on shared accounts making installation with the apt-get and dpkg, e.g. .deb files, problematic.

Luckily, Hugo makes available a set of binaries with each release on GitHub. Thus, the majority of work is downloading and extracting the binary. The instructions given next are modified from Hugo’s installing from a tarball overview.

Installing hugo from a binary

To obtain hugo’s latest version number visit:

Then, let’s install it with:

# Specify the version number desired

# Download hugo to the working directory

# Create a user binary directory
mkdir ~/bin

# Extract only the hugo binary 
tar -xvf hugo_${VERSION}_Linux-64bit.tar.gz hugo

# Move hugo binary into user-specific bin directory
mv hugo ~/bin/hugo

# Verify version
~/bin/hugo version

# Remove the tarball
rm -rf hugo_${VERSION}_Linux-64bit.tar.gz

From there, the $PATH variable needs to be modified to include the hugo binary version sitting in $HOME/bin. That is, we want to access hugo with hugo and not ~/bin/hugo. This modification is straightforward:

# Create a bash profile if it doesn't exist
touch .bash_profile

# Add a modified version of path to it and make it available in the session.
echo "export PATH=$PATH:$HOME/bin" >> .bash_profile


Voila, the installation of hugo on DreamHost is now complete!

comments powered by Disqus