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

JunaWeb VPS Special Offers

OpenVZ 256M $14/month 50% off for the first month...

Godaddy domain name discount code (continuously updated)

Registration discount code: Coupon code: cjc695do...

Tospeed 2GB RAM Los Angeles Cera KVM VPS Review

Details: Tospeed: 28 yuan/month/512MB memory/15GB...

Upgrade VestaCP's PHP version to PHP 7.0 or PHP 7.1 in CentOS 7

VestaCP is a very stable web panel that supports ...

SSLs: PositiveSSL 3 years for $8.3; PositiveSSL Wildcard 4 years for $30.88

SSLs, an American merchant, was founded in 2009 a...

Buyvm: $15/year/128MB memory/15GB space/500GB traffic/OpenVZ/Las Vegas/New York

Buyvm, a stable and established merchant, is the ...

Use DeltaCopy to easily backup and restore website files

File backup on the server can be completed throug...

Intellyhost: $5/month/2GB RAM/35GB SSD/4 TB bandwidth/KVM/France

Intellyhost, an Indian hosting provider, register...