{"id":10508,"date":"2021-09-28T10:09:47","date_gmt":"2021-09-28T10:09:47","guid":{"rendered":"https:\/\/linuxways.net\/?p=10508"},"modified":"2021-09-28T10:09:47","modified_gmt":"2021-09-28T10:09:47","slug":"how-to-install-and-use-hugo-static-website-generator-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-and-use-hugo-static-website-generator-on-ubuntu-20-04\/","title":{"rendered":"How to Install and Use Hugo Static Website Generator\u00a0on Ubuntu 20.04"},"content":{"rendered":"<p>Hugo is a quite popular tool for generating static websites. Static websites are those that do not process the data in terms of forms and generate documents. These websites consist of static informative pages. It is open-source and intended to design informative websites and small projects. The Hugo program is written in Go that makes it faster and secure. When you use Hugo, you do not need to install dependencies such as databases, python, and PHP to run Hugo websites.<\/p>\n<p>You will learn from this article how to install the Hugo website generator application on Ubuntu 20.04 system.<\/p>\n<h2><strong>Hugo installation on Ubuntu 20.04<\/strong><\/h2>\n<p>Using different ways, you can install Hugo on the Ubuntu 20.04 system. But, today we will only discuss two methods for installing Hugo:<\/p>\n<ol>\n<li>Install Hugo using the Ubuntu apt repository<\/li>\n<li>Install Hugo by downloading the .deb package<\/li>\n<\/ol>\n<h2><strong>Method 1: Install Hugo using the apt repository<\/strong><\/h2>\n<p>The Hugo application can be installed directly using the official Ubuntu apt repository. Open the terminal window and first update the all apt packages list. Then, install Hugo using Ubuntu apt repository by executing the below-mentioned command:<\/p>\n<pre>$ sudo apt update<\/pre>\n<pre>$ sudo apt install hugo<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"566\" class=\"wp-image-10509\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-550.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-550.png 906w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-550-300x187.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-550-768x480.png 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/p>\n<p>Using the above method, you can install the Hugo application quickly on your Ubuntu 20.04 system. But, the problem with this method is that it will not install the latest Hugo application version on your system. So, this method is not recommended for Hugo installation. You can verify this method using the following command:<\/p>\n<pre>$ hugo --version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"906\" height=\"102\" class=\"wp-image-10510\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-551.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-551.png 906w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-551-300x34.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-551-768x86.png 768w\" sizes=\"auto, (max-width: 906px) 100vw, 906px\" \/><\/p>\n<p>You will notice, the older Hugo version will be installed on your system<\/p>\n<h2><strong>Method 2: Install Hugo by downloading the .deb package<\/strong><\/h2>\n<p>Another alternative method is also available for Hugo installation on Ubuntu 20.04. The .deb Hugo package is available for download on a git repository to install the latest Hugo version. Download the latest Hugo .deb package from the git repository by running the command, which is mentioned below:<\/p>\n<pre>$ wget <a href=\"https:\/\/github.com\/gohugoio\/hugo\/releases\/download\/v0.79.0\/hugo_0.79.0_Linux-64bit.deb\">https:\/\/github.com\/gohugoio\/hugo\/releases\/download\/v0.79.0\/hugo_0.79.0_Linux-64bit.deb<\/a><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"148\" class=\"wp-image-10511\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-552.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-552.png 909w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-552-300x49.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-552-768x125.png 768w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/p>\n<p>Install the downloaded .deb package on your system by using the command as follows:<\/p>\n<pre>$ dpkg -i hugo_0.79.0_Linux-64bit.deb<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"918\" height=\"191\" class=\"wp-image-10512\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-553.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-553.png 918w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-553-300x62.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-553-768x160.png 768w\" sizes=\"auto, (max-width: 918px) 100vw, 918px\" \/><\/p>\n<p>After installing the required Hugo package, verify the Hugo installation by running the below-mentioned command:<\/p>\n<pre>$ hugo version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"915\" height=\"103\" class=\"wp-image-10513\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-554.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-554.png 915w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-554-300x34.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-554-768x86.png 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\" \/><\/p>\n<h2><strong>Start using Hugo on Ubuntu 20.04<\/strong><\/h2>\n<p>As all we know is that Hugo is a new static website generator. Create a new website using Hugo. Run the below-mentioned command to create a new website using Hugo:<\/p>\n<pre>$ hugo new site [path_website]<\/pre>\n<pre>$ hugo new site SampleSite<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"912\" height=\"325\" class=\"wp-image-10514\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-555.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-555.png 912w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-555-300x107.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-555-768x274.png 768w\" sizes=\"auto, (max-width: 912px) 100vw, 912px\" \/><\/p>\n<p>The above command will create a new folder with the name \u2018SampleSite\u2019. Navigate into it and start working in this folder. Add a new website theme. For that purpose, download multiple themes theme for testing using the git clone command as follows:<\/p>\n<pre>$ git clone --recursive https:\/\/github.com\/spf13\/hugoThemes themes<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"917\" height=\"654\" class=\"wp-image-10515\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-556.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-556.png 917w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-556-300x214.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-556-768x548.png 768w\" sizes=\"auto, (max-width: 917px) 100vw, 917px\" \/><\/p>\n<p>The above command will download all themes and it is necessary to put all themes in the \u2018theme\u2019 folder. Choose one theme for your website that you want to apply. Open the config.toml file in any text editor and paste the following lines:<\/p>\n<pre>baseURL = \"http:\/\/example.org\"\r\n\r\nlanguageCode = \"en-us\"\r\n\r\ntitle = \"My new hugo Site\"\r\n\r\ntheme = \"KeepIt\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"908\" height=\"235\" class=\"wp-image-10516\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-557.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-557.png 908w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-557-300x78.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-557-768x199.png 768w\" sizes=\"auto, (max-width: 908px) 100vw, 908px\" \/><\/p>\n<p>Now, create a new website index for your site by running the below-mentioned command:<\/p>\n<pre>$ hugo new _index.md<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"915\" height=\"78\" class=\"wp-image-10517\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-558.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-558.png 915w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-558-300x26.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-558-768x65.png 768w\" sizes=\"auto, (max-width: 915px) 100vw, 915px\" \/><\/p>\n<p>Here, you can add content using markdown.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"907\" height=\"667\" class=\"wp-image-10518\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-559.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-559.png 907w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-559-300x221.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-559-768x565.png 768w\" sizes=\"auto, (max-width: 907px) 100vw, 907px\" \/><\/p>\n<p>You can also create new categories and post by using the following commands:<\/p>\n<pre>$ hugo new [category]\/[file.md]<\/pre>\n<p>For creating new post:<\/p>\n<pre>$ hugo new posts\/[postname.md]<\/pre>\n<p>To view the whole website structure, run the below-given command:<\/p>\n<pre>$ hugo serve<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"543\" class=\"wp-image-10519\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-560.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-560.png 909w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-560-300x179.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-560-768x459.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-560-501x300.png 501w\" sizes=\"auto, (max-width: 909px) 100vw, 909px\" \/><\/p>\n<h2><strong>Conclusion\u00a0<\/strong><\/h2>\n<p>We implemented two different methods for installing Hugo on the Ubuntu 20.04 system in this article. Furthermore, we also discussed how to create a static website using Hugo. Using Hugo, you can quickly create a new static website.<\/p>","protected":false},"excerpt":{"rendered":"<p>Hugo is a quite popular tool for generating static websites. Static websites are those that do not process the data in terms of forms and generate documents. These&hellip;<\/p>","protected":false},"author":1,"featured_media":10636,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[490,100],"class_list":["post-10508","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-hugo","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10508"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10508\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10636"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}