Total Pageviews

Sunday 19 February 2017

搭建基于perl的静态博客程序plerd

linux vps一般已预装了perl环境。

cd /usr/local
git clone https://github.com/jmacdotorg/plerd plerd-site
cd plerd-site

root@AR:/usr/local/plerd-site# curl -fsSL https://cpanmin.us | perl - --installdeps .
root@AR:/usr/local/plerd-site# mkdir plerd
root@AR:/usr/local/plerd-site# cd plerd
root@AR:/usr/local/plerd-site/plerd# mkdir docroot source templates
root@AR:/usr/local/plerd-site/plerd# cd ..
root@AR:/usr/local/plerd-site# cp conf/plerd_example.conf conf/plerd.conf
root@AR:/usr/local/plerd-site# nano conf/plerd.conf
(修改base_uri的值为你的域名地址,我的为http://pld.bright.biz.st
修改path的值为/usr/local/plerd-site/plerd/ )
root@AR:/usr/local/plerd-site# cp -rf templates/* plerd/templates/
root@AR:/usr/local/plerd-site# ls
Changes      README.md     bin   cpanfile  log    run  templates
LICENSE.txt  app-daemon  conf  lib     plerd    t
root@AR:/usr/local/plerd-site# cd bin

root@AR:/usr/local/plerd-site/bin# ls
plerdall  plerdwatcher

(已经提供了可执行文件plerdall)
root@AR:/usr/local/plerd-site/bin# echo 'export PATH=$PATH:
/usr/local/plerd-site/bin' >> /etc/profile
root@AR:/usr/local/plerd-site/bin# . /etc/profile
(这2步的意思是把/usr/local/plerd-site/bin添加到环境变量)
root@AR:/usr/local/plerd-site/bin# cd ..
root@AR:/usr/local/plerd-site# cd plerd
root@AR:/usr/local/plerd-site/plerd# ls
docroot  source  templates
root@AR:/usr/local/plerd-site/plerd# cd
docroot
root@AR:/usr/local/plerd-site/plerd/docroot# ls
root@AR:/usr/local/plerd-site/plerd/docroot# plerdall
(此命令会在当前目录下,生成一些东西.此命令就是生成/更新静态网站的根目录的命令)
root@AR:/usr/local/plerd-site/plerd/docroot# ls
archive.html atom.xml recent.html
root@AR:/usr/local/plerd-site/plerd/docroot# 
(当前目录虽然无index.html文件,但是archive.html实际就起着index.html的作用。所以/usr/local/plerd-site/plerd/docroot就是静态网站的根目录)


新建源帖:
root@AR:/usr/local/plerd-site/plerd/docroot# cd ../source
root@AR:/usr/local/plerd-site/plerd/source# nano wu-yi-lane.md
root@AR:/usr/local/plerd-site/plerd/source# cat wu-yi-lane.md
---

title: 乌衣巷wu-yi-lane
time: 2017-02-19T17:46:00
---

【作者】:刘禹锡

【朝代】:唐
 
【体裁】:七言绝句

朱雀桥边野草花,

乌衣巷口夕阳斜。

旧时王谢堂前燕,

飞入寻常百姓家。

root@AR:/usr/local/plerd-site/plerd/source# cd ..

root@AR:/usr/local/plerd-site/plerd# cd docroot
root@AR:/usr/local/plerd-site/plerd/docroot# plerdall 
root@AR:/usr/local/plerd-site/plerd/docroot# ls
2017-02-19-wu-yi-lane.html archive.html atom.xml recent.html
root@AR:/usr/local/plerd-site/plerd/docroot# nano index.html
root@AR:/usr/local/plerd-site/plerd/docroot# cat index.html
<meta http-equiv=refresh content='0;url=/recent.html'>
root@AR:/usr/local/plerd-site/plerd/docroot#

演示网站:http://pld.bright.biz.st
项目地址:https://github.com/jmacdotorg/plerd

No comments:

Post a Comment