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

SoloGigabit: $544/year/4GB memory/160GB space/1Gbps/unlimited traffic/Spain

SoloGigabit, a Spanish merchant, mainly provides ...

AlphaRacks: $12/year/768MB/40GB space/2TB traffic/1 IP/OpenVZ/Los Angeles

AlphaRacks, famous for its low prices. Now, there...

HiFormance: $72/year/4G memory/100GB space/2TB traffic/KVM/Los Angeles

HiFormance, an American hosting company, has been...

Host Honey: $10/month/ATOM/2GB memory/160GB space/20TB traffic/US

Host Honey seems to be a newly established hostin...

Netcup: €16/month/16GB memory/1.6TB space/80TB traffic/KVM/Germany/Snapshots

Netcup, a German hosting company, is stable and c...

RajaMitra: $8/month/512MB RAM/10GB storage/unlimited traffic/KVM/Indonesia

RajaMitra, an Indonesian hosting provider, was fo...