首先搭建go环境:
cd /usr/local
wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
tar zxvf go1.8.linux-amd64.tar.gz
cd go
root@localhost:/usr/local/go# ls
api blog doc lib PATENTS robots.txt VERSION
AUTHORS CONTRIBUTING.md favicon.ico LICENSE pkg src
bin CONTRIBUTORS gopath misc README.md test
root@localhost:/usr/local/go# export PATH=$PATH:/usr/local/go/bin && echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
root@localhost:/usr/local/go# export GOROOT=/usr/local/go && echo 'export GOROOT=/usr/local/go' >> /etc/profile
root@localhost:/usr/local/go# mkdir gopath
root@localhost:/usr/local/go# cd gopath
root@localhost:/usr/local/go/gopath# export GOPATH=/usr/local/go/gopath && echo 'export GOPATH=/usr/local/go/gopath' >> /etc/profile
这样,go环境就搭建好了。以后需要进入GOPATH(这里为/usr/local/go/gopath)里面,运行go get,go install等命令,运行完后,所生成的可执行文件将出现在/usr/local/go/bin/里面。
root@localhost:/usr/local/go/gopath#
cd /usr/local
wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
tar zxvf go1.8.linux-amd64.tar.gz
cd go
root@localhost:/usr/local/go# ls
api blog doc lib PATENTS robots.txt VERSION
AUTHORS CONTRIBUTING.md favicon.ico LICENSE pkg src
bin CONTRIBUTORS gopath misc README.md test
root@localhost:/usr/local/go# export PATH=$PATH:/usr/local/go/bin && echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
root@localhost:/usr/local/go# export GOROOT=/usr/local/go && echo 'export GOROOT=/usr/local/go' >> /etc/profile
root@localhost:/usr/local/go# mkdir gopath
root@localhost:/usr/local/go# cd gopath
root@localhost:/usr/local/go/gopath# export GOPATH=/usr/local/go/gopath && echo 'export GOPATH=/usr/local/go/gopath' >> /etc/profile
这样,go环境就搭建好了。以后需要进入GOPATH(这里为/usr/local/go/gopath)里面,运行go get,go install等命令,运行完后,所生成的可执行文件将出现在/usr/local/go/bin/里面。
root@localhost:/usr/local/go/gopath#
go get github.com/alexanderteinum/simple-website
root@localhost:/usr/local/go/gopath# cd
/usr/local/
root@localhost:/usr/local# mkdir simple-website
root@localhost:/usr/local# cd
simple-website
root@localhost:/usr/local/
simple-website#
simple-website (此就是生成、更新静态网站的根目录的命令)
root@localhost:/usr/local/simple-website# ls
all-posts.html index.html pages _pages posts _posts _sections
root@localhost:/usr/local/simple-website#
(可见
/usr/local/simple-website就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/simple-website# cd
_posts
root@localhost:/usr/local/simple-website/_posts# nano
2017-03-26-test-1.md
root@localhost:/usr/local/simple-website/_posts# cat 2017-03-26-test-1.md
# 测试1
这是测试1.
看看如何?
root@localhost:/usr/local/simple-website/_posts# ls
2017-03-26-initial-post.md 2017-03-26-test-2.md 2017-03-26-vbilu.md
2017-03-26-test-1.md 2017-03-26-uce.md
root@localhost:/usr/local/simple-website/_posts#
root@localhost:/usr/local/simple-website/_posts# cd ..
root@localhost:/usr/local/simple-website#
simple-website
演示网站:http://sw.bright.biz.st/
项目地址:https://github.com/alexanderteinum/simple-website
No comments:
Post a Comment