Setting up a wiki with Gitit
It's often useful to have a place to dump personal notes. Wikis are ideal for this, however setting up a fully featured wiki like MediaWiki is often overkill. After spending a little bit of time looking at alternatives I stumbled across Gitit.
Gitit is relatively lightweight, can use multiple markup languages such as Markdown, and uses a Git repository to store page changes. This post is going to go over getting started with Gitit on Debian.
Gitit is part of the Debian repositories, therefore you can install it with
sudo apt-get update sudo apt-get install gitit libghc-filestore-data pandoc-data
pandoc-data should both be package
dependencies, but they are currently missing and need to be installed
explicitly (see bug #865605).
Alternatively you can compile Gitit from source using stack:
git clone https://github.com/jgm/gitit cd gitit stack install
If everything goes well you should now be able to use the
$ gitit --version gitit version 0.12.1.1 -plugins Copyright (C) 2008 John MacFarlane This is free software; see the source for copying conditions. There is no warranty, not even for merchantability or fitness for a particular purpose.
Creating a new wiki
Once Gitit is installed, running
gitit without any options will create the
initial files required for a wiki and startup a web server on port
$ mkdir ~/wiki $ cd ~/wiki $ gitit Created repository in wikidata Added Front Page.page to repository Added Help.page to repository Added Gitit Users Guide.page to repository Created static/css/custom.css Created static/img/logo.png Created templates/footer.st
The initial folder structure will be laid out as follows:
. +-- gitit.log +-- static ¦ +-- css ¦ ¦ +-- custom.css ¦ +-- img ¦ +-- logo.png +-- templates ¦ +-- footer.st +-- wikidata +-- Front Page.page +-- Gitit Users Guide.page +-- Help.page
wikidata is actually a Git repository, this makes it very easy to
manage and revert page changes.
If everything is working correctly you should now be able to access the wiki on
5001 in a web browser. The initial page should look similar to the
From here you can easily register an account and start editing pages. The
Gitit User's Guide pages should point you in the right direction
if you run into any problems.
Starting Gitit with systemd
gitit package doesn't come with a startup script. It is
however fairly easy to create a systemd unit file similar to the following:
[Unit] Description=Gitit wiki After=network.target [Service] ExecStart=/usr/bin/gitit WorkingDirectory=/home/user/wiki User=user Group=user [Install] WantedBy=multi-user.target
Note: make sure the
WorkingDirectory matches where you first run
Once you've create the file copy it to
then enable and start the service with
$ systemctl enable gitit.service Created symlink /etc/systemd/system/multi-user.target.wants/gitit.service ? /etc/systemd/system/gitit.service. $ systemctl start gitit.service
Gitit should now start automatically at boot. If you want to customise the unit file, the systemd.service man page is worth referring to for more info.