How To Install Hugo On Ubuntu 18.04

Introduction

Hugo is an open-source website framework developed in Go to help users create websites with ease. It is a reliable and modern static site generator used to create secure and extremely fast websites. Websites created using Hugo do not need a database to run and don’t depend on expensive run times such as Python, Ruby, or PHP.

There are three ways to install Hugo on your Ubuntu 18.04 which include:

  • Using Snap
  • Using apt-get
  • Downloading and Installing Hugo packages.

This tutorial will show you how to install Hugo using the second (using apt-get) and third method (downloading and installing Hugo). Using Snap is not a reliable method as it presents a number of issues and requires multiple dependencies.

Step 1 – Installing Hugo

Installing Hugo Using The Apt-get Utility

The first thing when installing Hugo using the apt-get is updating your server’s apt index:

$ sudo apt-getupdate

Once the package index is updated, run the command below to install Hugo:

$ sudo apt-get install hugo

Hugo will be installed automatically on your server. To check the Hugo version installed, run the command below:

$ sudo hugo version

This will give you an output showing the Hugo version:

Hugo Static Site Generator v0.40.1 linux/amd64 BuildDate:2018-04-25T17:16:11Z

Instaling Hugo using the apt-get comes with its own advantages and disadvantages. The method is straightforward, but may not install the most recent version of Hugo. If you want to install the latest version of Hugo (v0.50, at the time of writing), use the following method.

Installing Hugo Using The dpkg utility

This method may not be as simple as using the apt utility, but it enables you to install the latest Hugo version.

First, run the command below to confirm your server architecture:

$ sudo uname -i

This will print out the specs of your server:

X86_64

Now that you know your server architecture, visit the official Hugo release page to see the most recent stable release: at the time of writing this article, the latest release was Hugo v0.50.

Now, execute the following wget command to download the most recent release:

$ wget https://github.com/gohugoio/hugo/releases/download/v0.50/hugo_0.50_Linux-64bit.deb

Note: If prefer a specific version of Hugo, amend the command above to suit that particular version. For instance to download Hugo v0.25.1, run the command:

$ wget https://github.com/gohugoio/hugo/releases/download/v0.25.1/hugo_0.25.1_Linux-64bit.deb

Once the installation files are downloaded, issue the command below to extract the files and install Hugo package:

$ sudo dpkg -i hugo_0.50_Linux-64bit.deb

Next, execute the command below to delete the download package:

$ sudo rm hugo_0.30.2_Linux-64bit.deb

Then, run the command below to verify the installation:

$ sudo hugo version

This should give you an output showing the version of Hugo installed:

Hugo Static Site Generator v0.50 linux/amd64 BuildDate:2018-09-25T17:16:11Z

In case you find Hugo not useful, you can execute the command below to uninstall it:

$ sudo apt-getremove --auto-remove hugo

Step 2 – Install Hugo Themes

The Hugo themes help you present your website content in a way that appeals to your users/readers. Once you install Hugo, the next step is installing its themes. Hugo’s main package doesn’t provide any theme and the best way to install Hugo themes is cloning the Hugo themes Git repository. This repository presents numerous prebuilt themes:

First, run the command below to update the package index:

$ sudo apt-getupdate

Then issue the command below to install Git:

$ sudo apt-get install git

Next, run the command below to clone this theme repository:

$ sudo git clone--recursive https://github.com/spf13/hugoThemes ~/themes

Step 3 – Using Hugo

Creating A New Website

To create a website using Hugo, first, run the command below to create a directory for the website:

$ sudo mkdir hugo-sites

Change to this directory:

 $cd hugo-sites

Then run the command below to create the site:

hugo newsite hello-world

This will give you the output below:

Congratulations! Your new Hugo site is created in /root/hugo-sites/hello-world

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from https://themes.gohugo.io/, or
   create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want toaddsome content. You can add single files
   with"hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3.Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide andfull documentation.

Next, change the directory

$cd hello-world

And issue the command below:

$ sudo ls

This will give you the following output:

archetypes config.tomlcontent data layouts static themes

To preview your site issue the command below:

$ sudo hugo

This will deliver the following output:

                   | EN  
+------------------+----+
  Pages            |  3  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  0  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 33 ms

That is it!

Conclusion

You have successfully installed Hugo on your Ubuntu 18.04 VPS or dedicated server. You can explore detailed options and learn how to build impressive websites using this application.

Could you clarify what this means? Hugo is a web framework, whereas, the things you listed as having expensive runtimes are programming languages. Could you clarify this concept?

Check out these top 3 VPS services:

HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
IONOS
$1.00 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
Ultahost
$2.90 /mo
Starting price
Visit Ultahost
Rating based on expert review
  • User Friendly
    4.3
  • Support
    4.8
  • Features
    4.5
  • Reliability
    4.0
  • Pricing
    4.8

How to Create a Non-root User on Your Ubuntu 18.04 VPS or Dedicated Server

This guide shows you how to create a user on your Ubuntu 18.04 virtual server.
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Install a Self-Signed SSL Certificate on Your Ubuntu 18.04 VPS or Dedicated Server

This how-to article will teach you how to create a self-signed SSL certificate o
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to Set Up Cron Jobs on Your Ubuntu 18.04 Dedicated Server or VPS

This guide shows webmasters and administrators how to set up cron jobs on your U
3 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Install WordPress on Your Ubuntu 22.04 VPS or Dedicated Server

This tutorial will show you how to install WordPress on your Ubuntu 22.04 virtua
3 min read
Idan Cohen
Idan Cohen
Marketing Expert
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top