学Linux - 上红联!
Linux系统教程_红联Linux门户
Linux帮助

在Linux系统搭建gitit wiki

时间:2017-09-11来源:linux网站 作者:suxiang198
简述
对于喜欢用markdown写博客或做一些笔记,或者做学习知识库整理等等之类的,gitit wiki是不错的wiki系统选择。因为一般的markdown语法是很简单的,以至于太简单而许多需要使用稍微复杂些的图表之类的,就不能太好的支持,因此是比较影响书写的。因此对于markdown就出现了许多的Extended的版本,这其中有个Pandoc的,使用支持pandoc扩展语法的markdown写wiki,那么wiki原始.md文件,可以通过强大的Pandoc工具,可以在书籍格式、PDF格式、word格式、epub格式、html格式等等之间进行自动的生成,甚至可以生成PPT slide。
而gitit wiki系统,就可以显示这些支持pandoc extension的markdown语法的.md文件进行显示,有各种链接、图表展示等功能,很适合打造自己的私人wiki系统。
接下来介绍如何在Linux系统(可以是自己的Linux Server)上部署gitit wiki,之后自己可以使用自己的PC电脑进行登陆和wiki的维护与更新,只要联网,随时随地访问和更新。
 
Haskell开发工具安装
Why Haskell? 因为gitit是使用Haskell开发的,gitit的源码在github,因此Linux的方式是,将source code clone过来,然后安装Haskell开发工具,然后对gitit的源码进行编译和安装,这样就达到了安装gitit的目的。
 
stack
stack就是Haskell的开发工具,“Stack is a cross-platform program for developing Haskell projects.”跨平台。关于stack的说明以及安装,可参考The Haskell Tool Stack(https://docs.haskellstack.org/en/stable/README/)
在Linux系统搭建gitit wiki
我在自己的64 bit的Debian系统,使用如下命令安装stack:
curl -sSL https://get.haskellstack.org/ | sh
不过一开始并不能成功安装,shell给出了如下的log:
Detected Linux distribution: debian
Installing dependencies...
sudo: unable to resolve host my_host_name
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libffi-dev
E: Unable to locate package libgmp-dev
E: Unable to locate package zlib1g-dev
Installing apt packages failed.  Please run 'apt-get update' and try again.
于是按照提示输入:
apt-get update
果然更新了不少东西,然后再次输入上面的“curl -sSL https://get.haskellstack.org/ | sh”,此时就能安装成功了:
root@my_host_name:~# curl -sSL https://get.haskellstack.org/ | sh
Detected Linux distribution: debian
Installing dependencies...
sudo: unable to resolve host my_host_name
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++ is already the newest version.
g++ set to manually installed.
gcc is already the newest version.
libc6-dev is already the newest version.
libc6-dev set to manually installed.
make is already the newest version.
make set to manually installed.
xz-utils is already the newest version.
The following extra packages will be installed:
libgmpxx4ldbl
Suggested packages:
libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libffi-dev libgmp-dev libgmpxx4ldbl zlib1g-dev
0 upgraded, 4 newly installed, 0 to remove and 5 not upgraded.
Need to get 1,006 kB of archives.
After this operation, 2,778 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/debian/ jessie/main libgmpxx4ldbl amd64 2:6.0.0+dfsg-6 [22.1 kB]
Get:2 http://mirrors.cloud.aliyuncs.com/debian/ jessie/main libffi-dev amd64 3.1-2+deb8u1 [157 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/debian/ jessie/main libgmp-dev amd64 2:6.0.0+dfsg-6 [621 kB]
Get:4 http://mirrors.cloud.aliyuncs.com/debian/ jessie/main zlib1g-dev amd64 1:1.2.8.dfsg-2+b1 [206 kB]
Fetched 1,006 kB in 0s (2,417 kB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ... 39920 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a6.0.0+dfsg-6_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:6.0.0+dfsg-6) ...
Selecting previously unselected package libffi-dev:amd64.
Preparing to unpack .../libffi-dev_3.1-2+deb8u1_amd64.deb ...
Unpacking libffi-dev:amd64 (3.1-2+deb8u1) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a6.0.0+dfsg-6_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:6.0.0+dfsg-6) ...
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-2+b1_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-2+b1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for install-info (5.2.0.dfsg.1-6) ...
Setting up libgmpxx4ldbl:amd64 (2:6.0.0+dfsg-6) ...
Setting up libffi-dev:amd64 (3.1-2+deb8u1) ...
Setting up libgmp-dev:amd64 (2:6.0.0+dfsg-6) ...
Setting up zlib1g-dev:amd64 (1:1.2.8.dfsg-2+b1) ...
Processing triggers for libc-bin (2.19-18+deb8u10) ...
Using generic bindist...
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
100   628    0   628    0     0    180      0 --:--:--  0:00:03 --:--:--  1956
100 11.4M  100 11.4M    0     0   984k      0  0:00:11  0:00:11 --:--:-- 2397k
Installing Stack to: /usr/local/bin/stack...
Stack has been installed to: /usr/local/bin/stack
WARNING: '/root/.local/bin' is not on your PATH.
For best results, please add it to the beginning of PATH in your profile.
Haskell Platform
如果不想使用stack,Debian中可以安装Haskell Platform:
sudo apt-get install haskell-platform
 
gitit编译与安装
如果使用stack工具
首先安装git工具–“apt-get install git”,然后运行如下命令,分别是clone gitit源代码,在stack中编译与安装gitit:
git clone https://github.com/jgm/gitit
cd gitit
stack install
不过在使用stack install时,从log看貌似有些东西要从亚马孙awx镜像中去下载,好几次出现了connection timeout,不过尝试了多次,并中途用了stack setup后,stack install终于可以开始运作了,不过整个编译过程相对是比较缓慢的。
在该过程结束后,貌似gitit没有成功安装,因为gitit命令提示找不到。
没办法,还是安装Haskell Platform了。
 
如果使用Haskell Platform
使用如下的命令:
cabal update
cabal install gitit
使用cabal update命令后,会看到先找/root/.cabal/config,没有找到就会创建默认的,然后再去hackage.haskell.org下载最新的package。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/32571.html
------分隔线------