Creating a website is a process that requires time and in-depth knowledge of HTML and other languages. However, more and more tools are being created to help create one quickly and efficiently. Today I will show you how to install Hugo on Ubuntu 20.04 / Debian 10.
Hugo is a static web site generator. By static web sites we mean web sites that do not process data. That is, they cannot process forms or generate documents.
Usually these web sites are made for small projects and informative sites. Even small shops can display their products quickly.
Well, with Hugo you can create these websites quickly and easily.
Install Hugo on Ubuntu 20.04 / Debian 10
Hugo is a quite popular program and this makes installing it in Linux and specifically in Debian a simple process.
First of all, you can install Hugo through the official repositories of the distribution. To do this, open a terminal and run the following:
:~$ sudo apt install hugo
The main problem with this method is that the latest version available is not installed. And in many cases, very old versions.
So this method, although simple, is not recommended.
Another way to install it is through Homebrew. This package manager for Linux and macOS, guarantees that you get the latest stable version.
How to install Homebrew on Debian 10 / Ubuntu 20.04?
To install it using this tool, just use it:
:~$ brew install hugo
This method is quite reliable, but there is another.
Hugo can be installed using the pre-compiled packages for Debian. To download it, run the following command:
:~$ cd /tmp/
:~$ wget https://github.com/gohugoio/hugo/releases/download/v0.72.0/hugo_extended_0.72.0_Linux-64bit.deb
And then install it, with the following command:
:~$ sudo dpkg -i hugo_extended_0.72.0_Linux-64bit.deb
And now Hugo, you are available to work with him.
First step with Hugo
Hugo is a website generator. So the first thing to do is to create a new site.
:~$ hugo new site [path_site]
For example, I’ve created a new site:
:~$ hugo new site macaco
This will create a new folder called macaco. Access this folder and we will start the work from there.
The first thing is to add a new theme for the site. If you want to add all of them, you can use this command:
:~$ git clone --recursive https://github.com/spf13/hugoThemes themes
This install all the Hugo themes. It can be useful to test which one you want.
In my case, I chose a specific theme:
:~$ git clone https://github.com/matcornic/hugo-theme-learn.git themes/learn
It is important that you put the themes in the themes folder.
After the theme is installed, you have to tell Hugo to use that particular theme.
To do this, you need to define it in the config.toml
There you can also define other newly created site configurations.
Now, all you have to do is create a new index to be displayed on the site. You can create this with the following command:
:~$ hugo new _index.md
As you can see, the file has an md extension, this means that you can add content using markdown. Great.
You can also create new categories to shape the site:
:~$ hugo new [category]/[file.md]
And to view your website, use the following command:
:~$ hugo serve
| EN
-------------------+-----
Pages | 7
Paginator pages | 0
Non-page files | 0
Static files | 77
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Built in 608 ms
Watching for changes in /home/angelo/macaco/{archetypes,content,data,layouts,static,themes}
Watching for config changes in /home/angelo/macaco/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
And it will be available at http://localhost:1313. So, open your browser and go there.
The else is up to you. With Hugo you can create static websites quickly.
Conclusion
In short, Hugo is a program quite in line with the paradigms of our times. Where the speed and efficiency of the processes must be the norm for the creation of websites. In the case of Hugo, it only creates static websites but it is very useful in certain cases.
Please share this post and join our Telegram channel.
More info: Hugo website, Hugo documentation.