• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

How To Create A Blog With Hugo

How VPS by How VPS
January 1, 2020
in Linux
0
0
SHARES
112
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Introduction
  2. Prerequisites
  3. Step 1: Install the Hugo program
  4. Step 2: Build your site
  5. Step 3: Install themes from the Hugo repository
  6. Step 4: Make some basic configuration changes
  7. Step 5: Compose your content
  8. Step 6: Adjust your content with the Hugo server
  9. Step 7: Publish your site
  10. Want to contribute?


Introduction

Hugo is a static site generator with lightning fast rendering speed and excellent ease of use. Thanks to all of its content-oriented features, you can always focus on creating content rather than building the environment:

  • With Hugo, you can build a running-anywhere static site in several minutes without concerning tedious dependencies or databases.
  • You can compose your content in Markdown, the most convenient writing style, and instantaneously see the changes you’ve made on the web.
  • Furthermore, you can make the most of Hugo’s affluent theme repository and fast-growing community.

In this tutorial, I will show you how to install and use Hugo to build a static blog site on a CentOS-based Vultr LEMP server instance.

Prerequisites

Login to your instance as a non-root user with sudo permissions. See how to create such a user in this article.

Step 1: Install the Hugo program

Hugo can be installed on almost all of the mainstream platforms. For CentOS, you just need to download the latest program file in a .tar.gz archive and unzip it to a convenient location. At the time of writing, the latest version is 0.15.

sudo yum update -y
sudo yum install git -y
cd ~
wget https://github.com/spf13/hugo/releases/download/v0.15/hugo_0.15_linux_amd64.tar.gz
tar -zxvf hugo_0.15_linux_amd64.tar.gz
sudo mv hugo_0.15_linux_amd64/hugo_0.15_linux_amd64 /usr/local/bin/hugo

Test your installation with the following command:

 hugo version

Step 2: Build your site

With Hugo, you can build your site from within any folder on your server. Here, I built a site in the directory mysite/ under my home directory.

cd ~
hugo new site ~/mysite

Run the following commands to see the site’s architecture:

cd mysite
ls -lF

As you see, the site’s current architecture resembles:

archetypes/

config.toml

content/

data/

layouts/

static/

With another two to-be-created directories, themes/ and public/, the whole architecture of a Hugo site is compact yet comprehensive.

As a starter, know that your content should be stored in the directory content/.

Step 3: Install themes from the Hugo repository

To install all themes from the Hugo repository, run the following commands. These will create a directory named themes/ in your site directory and download all of the themes from the Hugo theme repo.

cd ~/mysite/
git clone --depth 1 --recursive https://github.com/spf13/hugoThemes.git themes

If you just want to install a single theme, visit the Hugo theme repo to determine your favorite theme. Copy its URL and paste it into the git clone command below.

cd ~/mysite/
mkdir themes
cd themes
git clone https://github.com/jaden/twentyfourteen

Step 4: Make some basic configuration changes

The file named config.toml in your site directory contains the global configuration for your Hugo site. Edit the file with a text editor to make some basic configuration changes as listed below. Remember to replace the values according to your specific conditions.

baseurl = "http://[YourSiteIP]/"
languageCode = "en-us"
title = "Your Site Name"
theme = "twentyfourteen"

Step 5: Compose your content

In your site directory, input the following command to create a content page in the directory ~/mysite/content/post/.

cd ~/mysite/
hugo new post/about.md

Open the file in a text editor, the format of the file should resemble the following.

+++
date = "2015-12-25T03:21:23Z"
draft = true
title = "about"

+++

Between the two lines of +++ lies the meta information about your content page. Here, you can remove the line draft = true and modify the title line as you wish.

Under the second +++ line, add the content that you want to display on the web page. Remember to write your content in the Markdown language.

## This is an H2 headline

Text goes here.

After finishing this edit, keep the text editor open for later use.

Step 6: Adjust your content with the Hugo server

You can use Hugo’s built-in web server to deploy your site, which can instantaneously display your changes on the web page as soon as you modify your content in a text editor.

Open another terminal, configure the iptables rules to allow your access to your site on Hugo server’s default port 1313:

sudo iptables -I INPUT -p tcp --dport 1313 -j ACCEPT

Launch the Hugo server:

hugo server --bind="[YourServerIP]"

Visit your site from a browser:

http://[YourServerIP]:1313

Now, you can try to edit the content of the page file in the previous terminal or add/remove a page file. You will find that any modifications in the content/ directory will be reflected simultaneously on your browser screen. This is a great feature for a busy blogger because you can always immediately see your modifications for better composing experiences.

After you finish your edit, press Ctrl+C to stop the Hugo server.

Step 7: Publish your site

Now it is time to publish your site on the web. Run the following commands and Hugo will generate all of the static content suitable for publishing within the public/ directory.

cd ~/mysite
hugo

Note: Hugo will not delete old files which were generated previously when you run the commands above. In order to avoid unexpected results, you can always delete the public/ directory before you run the hugo command or specify a new output destination as shown in the following command.

hugo --destination=public2

Since the Nginx web server has already been running on the server, all you need to do is copy the content of the ~/mysite/public/ directory or other custom destination directories to your web directory /usr/share/nginx/html/.

Delete the original files:

cd /usr/share/nginx/html/
sudo rm -rf background.jpg index.php logo.png

Copy your static site files to the web directory:

cd ~/mysite/public
sudo cp -R ~/mysite/public/. /usr/share/nginx/html/

That’s it. Now you can visit your super fast static site from your browser: http://[YourServerIP].

To see more details, use the command hugo help or visit the Hugo official website.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Installing JXCore

Next Post

How to Install SonarQube on Ubuntu 16.04

Next Post

How to Install SonarQube on Ubuntu 16.04

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet