Using Hugo to create a static page blog under Debian

Using Hugo to create a static page blog under Debian

All are done under the command line. It may seem complicated to novices, but it is actually just a step-by-step process.
This article was successfully built under Debian 7 6-bit.

First upgrade the system and install git

 apt-get update apt-get install git

1. Install go
1. Download go

 cd /tmp wget --no-check-certificate https://dl.google.com/go/go1.10.linux-amd64.tar.gz

The version used is go1.10, but you can also use other versions.

 tar -C /usr/local -xzf go1.10.linux-amd64.tar.gz

2. Add configuration files (located in the /root directory, such files ~/.bashrc, ~/.zshrc)

 export PATH=$PATH:/usr/local/go/bin export GOROOT='/usr/local/go' export GOPATH='/home/root/projects/go' export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN

Change the root in /home/root/projects/go to your own username. I used root directly.

3. Activate environment variables and create directories

 cd /root source ~/.bashrc mkdir -p $GOPATH

This way the Golang environment is installed.

2. Install hugo and create a blog
1. Install hugo

 go get -u -v github.com/gohugoio/hugo

2. Use hugo template to create a blog

 cd $GOPATH/src/github.com/gohugoio/hugo/examples/ cp -r blog /tmp/static-site-hugo cd /tmp/static-site-hugo hugo hugo server -b "URL" --bind "IP_ADDR" -p 9999

URL is your bound domain name, you can also use IP, IP_ADDR is the server IP, 9999 is the access port, so you can access it using the domain name or IP:9999

3. Start adding blog posts. In the /tmp/static-site-hugo/content/post/ directory, create a file ending with .md, such as 001.md.
Use markdown syntax.

 cd /tmp/static-site-hugo/content/post/ vi 001.md

Add it in the following format

 --- title: "第一篇,測試" description: "主機百科測試hugo" date: "2018-04-02" categories: - "kvm" - "openvz" tags: - "virmach" - "ramnode" - "blog" ---第一篇測試博文,來自主機百科

.
4. Use screen to run the website in the background
a. Install screen

 apt-get install screen

b. Enter the blog directory and create a session

 cd /tmp/static-site-hugo screen -S hugo

c. Run hugo to make the blog accessible
hugo server -b “URL” –bind “IP_ADDR” -p 9999
d. When you need to add an article, press ctrl + c to stop running hugo, and then enter exit to stop running screen.
After adding the article, repeat the command to create a session (steps b and c).
According to the author of the cited article, hugo will automatically update some changes, so you can edit them later.

5. Modified templates and blog posts are all in the /tmp/static-site-hugo directory. It is recommended to use WinSCP software to edit and upload directly.
In the /tmp/static-site-hugo/layouts/partials directory, you can modify the header, footer, column, sidebar and other information.

Demo: http://137.175.66.54:9999/

Partial reference: https://wooservers.com/blog/build-your-first

<<:  Cloudcom: $10/month/2GB memory/40GB space/3TB traffic/10Gbit/DDOS/VMware/Switzerland

>>:  UANode: $15/year/512MB RAM/25GB SSD space/unlimited traffic/LXC/Ukraine

Recommend

PoundHost: £9.5/month/Atom D525/2GB RAM/250GB hard drive/5TB bandwidth

PoundHost, a UK registered company (06333189), is...

GreenCloudVPS 1GB RAM 200GB Space 1Gbps Bandwidth Japan KVM VPS Review

Details : GreenCloudVPS: $24/year/1GB memory/200G...

HudsonValleyHost: $2.5/month/512MB memory/15GB space/2TB traffic/Windows

HudsonValleyHost started providing hosting servic...

SSD VPS: $38/year/512MB RAM/20GB SSD space/2000G traffic/OpenVZ

Introduction SSD VPS is an American hosting compa...

One-click script to install the pure version of CentOS under Linux network

If you need a pure Debian/Ubuntu system, please s...

Installing a graphical interface for VPS - Installing kloxo panel

Now graphical interface is deeply rooted in peopl...

Asia.Cloud: $7/month/512MB memory/30GB SSD space/1TB traffic/KVM/Hong Kong CN2

Asia.Cloud is a Hong Kong business that seems to ...

Aulerion 512MB RAM San Jose KVM VPS Review

1. Introduction to Aulerion VPS: Aulerion: You ge...

LAUNCH VPS: $48/year/4GB RAM/20GB SSD space/4TB bandwidth/KVM/Philadelphia

LAUNCH VPS, a US hosting provider, provides kvm v...

Hostient: $15/year/5G space/50G traffic

Hostient is an American hosting company founded i...